pub struct Zstd { /* private fields */ }Expand description
zstd compression wrapper for outgoing and incoming links.
Only IO-based streams are supported; wrapping a packet-based stream fails.
Add this to a ConnectorBuilder and the
AcceptorBuilder of the remote endpoint
to compress all links of the connection.
Implementations§
Source§impl Zstd
impl Zstd
Sourcepub const DEFAULT_LEVEL: i32 = 1
pub const DEFAULT_LEVEL: i32 = 1
Default compression level.
This is the fastest regular level of zstd.
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new zstd compression wrapper using the default level.
Sourcepub fn with_level(level: i32) -> Self
pub fn with_level(level: i32) -> Self
Creates a new zstd compression wrapper using the specified compression level.
Higher levels compress better but are slower. Negative levels are faster than level 1 but compress worse. The level is clamped to the range supported by zstd.
Sourcepub fn set_window_log(&mut self, window_log: Option<u32>)
pub fn set_window_log(&mut self, window_log: Option<u32>)
Sets the base 2 logarithm of the maximum window size.
This limits the memory used for compressing and decompressing each link. Received data that was compressed using a larger window cannot be decompressed, thus both ends must use the same setting.
If None (default), the window size is determined by the compression level
for compressing and the default limit of zstd (128 MiB) applies to decompressing.