- Notifications
You must be signed in to change notification settings - Fork81
Rust crate package to link to a system libz (zlib)
License
Apache-2.0, MIT licenses found
Licenses found
rust-lang/libz-sys
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A common library for linkinglibz
to Rust programs (also known as zlib).
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.
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.
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.
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.
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE orhttps://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT orhttps://opensource.org/license/mit/)
at your option.
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
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.