/// The current stream state /// /// # Custom allocators /// /// The low-level API supports passing in a custom allocator as part of the [`z_stream`]: /// /// ```no_check /// struct z_stream { /// // ... /// zalloc: Option<unsafe extern "C" fn(*mut c_void, c_uint, c_uint) -> *mut c_void>, /// zfree: Option<unsafe extern "C" fn(*mut c_void, *mut c_void)>, /// opaque: *mut c_void, /// } /// ``` /// /// When these fields are `None` (or `NULL` in C), the initialization functions use a default allocator, /// based on feature flags: /// /// - `"rust-allocator"` uses the rust global allocator /// - `"c-allocator"` uses an allocator based on `malloc` and `free` /// /// When both are configured, the `"rust-allocator"` is preferred. When no default allocator is configured, /// and custom `zalloc` and `zfree` are provided, the initialization functions will return a [`Z_STREAM_ERROR`]. /// /// When custom `zalloc` and `zfree` functions are given, they must adhere to the following contract /// to be safe: /// /// - a call `zalloc(opaque, n, m)` must return a pointer `p` to `n * m` bytes of memory, or /// `NULL` if out of memory /// - a call `zfree(opaque, p)` must free that memory /// /// The `strm.opaque` value is passed to as the first argument to all calls to `zalloc` /// and `zfree`, but is otherwise ignored by the library. #[repr(C)] #[derive(Copy, Clone)] pubstruct z_stream { pub next_in: *const Bytef, pub avail_in: uInt, pub total_in: z_size, pub next_out: *mut Bytef, pub avail_out: uInt, pub total_out: z_size, pub msg: *mut c_char, pub state: *mut internal_state, pub zalloc: Option<alloc_func>, pub zfree: Option<free_func>, pub opaque: voidpf, pub data_type: c_int, pub adler: z_checksum, pub reserved: uLong,
} pubtype z_streamp = *mut z_stream;
/// gzip header information passed to and from zlib routines. /// See RFC 1952 for more details on the meanings of these fields. #[derive(Debug)] #[repr(C)] pubstruct gz_header { /// true if compressed data believed to be text pub text: i32, /// modification time pub time: c_ulong, /// extra flags (not used when writing a gzip file) pub xflags: i32, /// operating system pub os: i32, /// pointer to extra field or NULL if none pub extra: *mut u8, /// extra field length (valid if extra != NULL) pub extra_len: u32, /// space at extra (only when reading header) pub extra_max: u32, /// pointer to zero-terminated file name or NULL pub name: *mut u8, /// space at name (only when reading header) pub name_max: u32, /// pointer to zero-terminated comment or NULL pub comment: *mut u8, /// space at comment (only when reading header) pub comm_max: u32, /// true if there was or will be a header crc pub hcrc: i32, /// true when done reading gzip header (not used when writing a gzip file) pub done: i32,
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.