Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rust crate package to link to a system libz (zlib)

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

rust-lang/libz-sys

A common library for linkinglibz to Rust programs (also known as zlib).

Documentation

This also serves as the source for thelibz-ng-sys crate, which buildszlib-ng natively (not in zlib-compat mode). SeeREADME-zng.md for details.

High-level API

This crate provides bindings to the raw low-level C API. For a higher-levelsafe API to work with DEFLATE, zlib, or gzip streams, seeflate2.flate2 also supports alternativeimplementations, including slower but pure Rust implementations.

zlib-ng

This crate supports building either the high-performance zlib-ng (inzlib-compat mode), or the widely available stock zlib.

By default,libz-sys uses stock zlib, primarily because doing so allows theuse of a shared system zlib library if available.

Any application or library designed for zlib should work with zlib-ng inzlib-compat mode, as long as it doesn't make assumptions about the exact sizeor output of the deflated data (e.g. "compressing this data produces exactlythis many bytes"), and as long as you don't also dynamically pull in a copy ofstock zlib (which will produce conflicting symbols). Nonetheless, for maximumcompatibility, every library crate in a build must opt into allowing zlib-ng;if any library crate in your dependency graph wants stock zlib,libz-sys willuse stock zlib.

Library crates depending onlibz-sys should use:

libz-sys = {version ="1.1",default-features =false,features = ["libc"] }

(Omit thelibc feature if you don't require the corresponding functions.)

This allows higher-level crates depending on your library to opt into zlib-ngif desired.

Building zlib-ng requirescmake unless thezlib-ng-no-cmake-experimental-community-maintained feature is enabled,in which casecc is used instead. Note that this option enablesall compilerfeatures that are supported for the given target, which may not compile on oldercompilers or targets without certain headers.

Crates that don't require compatibility with the zlib C API, and use zlibexclusively from Rust or support the zlib-ng native C API (prefixed withzng_) can uselibz-ng-sys instead,which allows zlib and zlib-ng to coexist in the same program. SeeREADME-zng.md for details.

Minimum Supported Rust Version (MSRV) Policy

This crate uses the same MSRV policy as theflate2 crate: This crate supports thecurrent and previous stable versions of Rust. Older versions of Rust may work,but we don't guarantee these will continue to work.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submittedfor inclusion inlibz-sys by you, as defined in the Apache-2.0 license, shallbe dual licensed as above, without any additional terms or conditions.

About

Rust crate package to link to a system libz (zlib)

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Security policy

Stars

Watchers

Forks

Contributors52

Languages


[8]ページ先頭

©2009-2025 Movatter.jp