Repository navigation
Releases
Releases · gyscos/zstd-rs
v0.14.2
zstd 0.14.2
This release adds decoder APIs that let archive libraries recover their readers
without consuming more compressed input or losing ownership on initialization
errors.
- Add
stream::read::Decoder::into_inner(), which returns the underlying reader
at its current position without additional I/O. This supports raw copying of
compressed archive entries. Addresses #381
and the regression reported in #380. - Add
Decoder::try_new,try_with_buffer,try_with_dictionary,
try_with_prepared_dictionary, andtry_with_ref_prefix. These return
Result<Self, (R, io::Error)>, preserving the original reader if decoder
initialization fails. Addresses #382. - Return an I/O error if a streaming decoder cannot allocate its decompression
context, instead of panicking. - Clarify that
finish_frame()can stop before the end of a frame when decoded
output remains unread.
Decoder::finish() keeps its 0.14 behavior: it attempts to consume remaining
frame input before returning the reader. Archive libraries that need to recover
compressed bytes should use into_inner() and adopt the new try_* constructors
where they need to retain the reader after initialization failure. Existing
constructor signatures remain unchanged.
Rust 1.64 remains supported.
v0.14.0
Breaking
- The
with_prepared_dictionary()constructors now borrow the dictionary for as long as the stream (#372). The dictionary is registered with the underlying context by pointer, so dropping it early left the stream with a dangling pointer - reachable from safe code. - The project is now licensed under BSD-3-Clause (#360, #314).
- Requires zstd-safe 8.0.0.
Fixed
Decoder::finish()now consumes the rest of the frame, so the reader is handed back positioned just after it (#251, #255). zstd can produce the last of the decoded data before it has read the frame epilogue, so a caller who stops reading once it has the bytes it wanted used to get its reader back pointing inside the frame. Note thatfinish()may now read from the underlying reader;Decoder::finish_frame()is the same operation with the error surfaced.Read::read()with an empty buffer returnsOk(0)instead of an error (#318).
New
zstd-sys v2.1.0
Breaking
- The
bindgenfeature is no longer enabled by default (#371). The pre-generated bindings are used unless you opt in, solibclangis no longer needed for a default build. This makes hermetic and cross builds much easier (#370). - The project is now licensed under BSD-3-Clause (#360, #314).
New
cmakefeature: build the C library with zstd's own CMake files instead ofcc, which handles cross-compilation better (#229).vendoredfeature: always build the bundled C source, even whenpkg-configis enabled, so a dependent crate can force a static build (#309).
Fixed
- The wasm shim's
qsortandmemcmpare nowunsafe(#367). - The x86-64 assembly is only built for x86_64 targets. It could never contribute code elsewhere - upstream gates it on
__x86_64__- and some toolchains, wasm ones especially, cannot process.Sinput at all (#368). -fvisibility=hiddenis no longer passed to MSVC (#352), and that is now decided from the target rather than the host, so cross-compiling to a*-windows-msvctarget works too.
zstd-safe v8.0.0
Breaking
CCtx::ref_cdict()andDCtx::ref_ddict()now borrow the dictionary for as long as the context. zstd stores the dictionary in the context by pointer and dereferences it on every later operation, so safe code could previously drop the dictionary and cause a use-after-free.AdvancedSeekableno longer implementsDerefMut(#366). Handing out a&mut Seekablelet safe codemem::swap()the context out and leave the swapped-out one holding a pointer to a reader this type frees on drop.decompress()anddecompress_frame()are available directly onAdvancedSeekableinstead, andDerefstill covers the read-only queries.
Fixed
- A context is no longer reused after an error left it in a state zstd considers undefined (#315). zstd documents calling the streaming functions again on such a context as undefined behaviour; they now return the original error until something resets the context.
Cursorpositions are no longer truncated when converted tousize, which on a 32-bit target could turn an out-of-range position into a small in-range one and read or write the wrong part of the buffer.Seekable::init_advanced()no longer leaks the boxed reader when initialization fails.
Other
- New
cmakeandvendoredfeatures, forwarded tozstd-sys. ResetDirectivederivesCopy,Clone,Debug,PartialEqandEq, like the crate's other parameter enums.- The
SendandSyncimpls carry safety comments explaining why they hold.
v0.13.0
zstd-sys v2.0.9
- Fix build on wasm32 using default features
- Fix allocation issues in wasm32
- Use core::ffi rather than libc type aliases
- Include zstd error methods and types in experimental bindings
- Update bindgen from 0.64 to 0.68
zstd-safe v7.0.0
OutBuffer::dstis no longer public.- Added
OutBuffer::as_mut_ptrandOutBuffer::capacity. - Replaced libc with core::ffi for type aliases.
v0.11.0
Breaking changes
- Moves dictionary-training operations behind a
zdict_builderdefault feature.
Using a dictionary does not need this feature; only training/creating a new one does. - Disable exporting unrelated constants in zstd-sys.
Updates
Can now compile for wasm32-unknown-unknown target.
v0.10.0
Breaking changes
- Rename the
blockmodule tobulk. It was never really zstd' "block" API (which apparently might not even stay public forever), but just a way to compress data that fits entirely in-memory.- It was also refreshed to be on-par with the stream API regarding dictionaries and compression parameters.
Updates
- Update zstd to 1.5.2
- zstd_safe: Add
{C,D}Ctx::try_cloneto clone an existing context. Note that this only clones the compression parameters, not the current "stream context". As such, it should only be called before any data has been sent. - Documentation: add doc-cfg tags to indicate the features required for each type/function.
0.9.1
This bumps the zstd version to 1.5.1.
It also brings some improvements to the rust wrapper:
- Functions to turn on multithreaded compression are only available when the
zstdmtfeature is enabled - Implementations for arrays in zstd-safe use const-generics, and are now gated behind an
arraysfeature to allow compatibility with old compilers. - Add
set_pledged_src_sizeto encoders. This can improve the compression ratio, and makes the content size available in the compressed header. - Add an auto-flush wrapper to the push decoder.