compress_lib/lib.rs
1//! # compress_lib
2//!
3//! DEFLATE (RFC 1951), zlib (RFC 1950), and gzip (RFC 1952) for Rust
4//! services, with the per-message rules of WebSocket permessage-deflate
5//! (RFC 7692).
6//!
7//! The engine is sans-IO: the caller pushes input and pulls output through
8//! buffers it owns. Memory is fixed when an engine is built and never grows
9//! with input, and every decoder enforces an absolute output cap while it
10//! decodes, so a decompression bomb costs at most the cap. There is no
11//! `unsafe` code and no third-party runtime dependency.
12//!
13//! ## Status
14//!
15//! `0.1.0`, the scaffold: the crate claims its name and carries the plan.
16//! The codecs arrive from `0.3` (inflate) and `0.4` (deflate and RFC 7692);
17//! the complete planned API, each item with its version, is `dev/PLAN.md` in
18//! the [repository](https://github.com/jamesgober/compress-lib).
19
20#![doc(html_root_url = "https://docs.rs/compress-lib")]
21#![cfg_attr(docsrs, feature(doc_cfg))]
22#![cfg_attr(not(feature = "std"), no_std)]
23#![forbid(unsafe_code)]
24#![deny(missing_docs)]
25#![cfg_attr(
26 not(test),
27 deny(
28 clippy::unwrap_used,
29 clippy::expect_used,
30 clippy::panic,
31 clippy::todo,
32 clippy::unimplemented,
33 clippy::unreachable,
34 clippy::dbg_macro
35 )
36)]
37
38/// Crate version string, populated by Cargo at build time.
39pub const VERSION: &str = env!("CARGO_PKG_VERSION");
40
41#[cfg(test)]
42mod tests {
43 use super::VERSION;
44
45 #[test]
46 fn test_version_matches_manifest() {
47 assert_eq!(VERSION, env!("CARGO_PKG_VERSION"));
48 let core = VERSION.split(['-', '+']).next().unwrap_or_default();
49 assert_eq!(core.split('.').count(), 3);
50 assert!(core.split('.').all(|part| part.parse::<u64>().is_ok()));
51 }
52}