#zlib #zlib-ng

sys libz-sys

Low-level bindings to the system libz library (also known as zlib)

39 releases (stable)

Uses old Rust 2015

new 1.1.3 Apr 29, 2021
1.1.2 Sep 4, 2020
1.1.1 Aug 30, 2020
1.0.25 Oct 24, 2018
0.1.0 Nov 27, 2014

#19 in Compression

Download history 88816/week @ 2021-01-13 90479/week @ 2021-01-20 92404/week @ 2021-01-27 94007/week @ 2021-02-03 94335/week @ 2021-02-10 105088/week @ 2021-02-17 102194/week @ 2021-02-24 100180/week @ 2021-03-03 109937/week @ 2021-03-10 102248/week @ 2021-03-17 101505/week @ 2021-03-24 94006/week @ 2021-03-31 109562/week @ 2021-04-07 105946/week @ 2021-04-14 115032/week @ 2021-04-21 99435/week @ 2021-04-28

439,474 downloads per month
Used in 1,264 crates (37 directly)

MIT/Apache

2.5MB
53K SLoC

C 30K SLoC // 0.2% comments Visual Studio Project 15K SLoC Ada 1.5K SLoC // 0.2% comments GNU Style Assembly 1.5K SLoC // 0.3% comments Assembly 1.5K SLoC // 0.2% comments Pascal 1K SLoC // 0.2% comments C# 879 SLoC // 0.4% comments Visual Studio Solution 655 SLoC C++ 599 SLoC // 0.2% comments Shell 509 SLoC // 0.2% comments Rust 353 SLoC // 0.1% comments Automake 34 SLoC BASH 29 SLoC // 0.2% comments Batch 4 SLoC

libz-sys

A common library for linking libz to rust programs (also known as zlib).

Documentation

High-level API

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

zlib-ng

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

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

Any application or library designed for zlib should work with zlib-ng in zlib-compat mode, as long as it doesn't make assumptions about the exact size or output of the deflated data (e.g. "compressing this data produces exactly this many bytes"), and as long as you don't also dynamically pull in a copy of stock zlib (which will produce conflicting symbols). Nonetheless, for maximum compatibility, 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 will use stock zlib.

Library crates depending on libz-sys should use:

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

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

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

Building zlib-ng requires cmake.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in libz-sys by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies