Crates.io | cloudflare-zlib |
lib.rs | cloudflare-zlib |
version | 0.2.10 |
source | src |
created_at | 2018-11-23 23:25:18.251013 |
updated_at | 2023-10-14 17:27:00.073331 |
description | Safe wrapper for Cloudflare's optimized zlib |
homepage | https://github.com/cloudflare/zlib |
repository | https://gitlab.com/kornelski/cloudflare-zlib-sys |
max_upload_size | |
id | 98356 |
size | 17,223 |
This is a Rust wrapper for Cloudflare's SIMD-accelerated fork of zlib.
It requires x86-64 CPU with SSE 4.2 or ARM64 with NEON & CRC. It does not support 32-bit CPUs at all.
Note: you will have to ensure that the program using cloudflare-zlib
does not link with any other version of libz
. Otherwise the accelerated version may not be used, or the program could even crash. Because of a Cargo issue this crate doesn't prevent this problem.
If arm-always
feature is set (build with --features=arm-always
), ARM will be supported without a runtime check (i.e. it will crash if run on an unsupported ARM CPU). Otherwise it will fail gracefully on an incompatible CPU.
use cloudflare_zlib::*;
let mut stream = Deflate::new(Z_BEST_COMPRESSION, Z_DEFAULT_STRATEGY, 15)?;
stream.compress(b"lorem")?;
stream.compress(b" ipsum")?;
let compressed = stream.finish()?;
(C) 1995-2017 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
Jean-loup Gailly jloup@gzip.org Mark Adler madler@alumni.caltech.edu
If you use the zlib library in a product, we would appreciate not receiving lengthy legal documents to sign. The sources are provided for free but without warranty of any kind. The library has been entirely written by Jean-loup Gailly and Mark Adler; it does not include third-party code.
If you redistribute modified sources, we would appreciate that you include in the file ChangeLog history information documenting your changes. Please read the FAQ for more information on the distribution of modified source versions.
This project is licensed under either of
at your option.