Registry / other / zstd-sys

zstd-sys

JSON →
library2.0.16+zstd.1.5.7rscratesunverified

Low-level FFI bindings to the zstd compression library.

# Cargo.toml [dependencies] zstd-sys = "2.0.16+zstd.1.5.7"
INSTALL
IMPORT
SIG · ZSTD-SYS
Z
zstd-sys
otherrustv2.0.16+zstd.1.5.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ZSTD_compress
use zstd_sys;

Compress data using raw zstd C API.

use std::ffi::CString; use zstd_sys::ZSTD_compress; let src = b"Hello, world!"; let mut dst = vec![0u8; 100]; unsafe { let size = ZSTD_compress(dst.as_mut_ptr(), dst.len(), src.as_ptr(), src.len(), 1); assert!(!zstd_sys::ZSTD_isError(size)); dst.truncate(size as usize); }
Debug
Known issues
gotchaRequires zstd C library installed; may need pkg-config or manual linking.
fix
Install zstd via system package manager or use zstd crate (safe wrapper).
affects: >=2.0.0
Upgrade
Version history
2.0.16+zstd.1.5.7latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
44 hits · last 30 days
node
38
OpenAI (training)
1
Resources
zstd-sys — cargo add zstd-sys · libregistry