silk.compress.limits.
Resource limits and failures for complete-buffer compression codecs.
Details#
LZMA, LZMA2, and XZ decode into caller-owned byte buffers. Limits bound input, output, dictionary references, and allocated probability tables. Discard output after any error.
Import as compression with import silk.compress.limits as compression.
Public declarations: 4.
DecodeLimits#
pub struct DecodeLimitsLimits for one complete decode. Zero permits no bytes for that resource.
Field maxInputBytes#
pub maxInputBytes: usizeMaximum length of the supplied compressed input.
Field maxOutputBytes#
pub maxOutputBytes: usizeMaximum bytes to write into the caller's output buffer.
Field maxDictionaryBytes#
pub maxDictionaryBytes: u64Maximum dictionary size declared by the stream or raw LZMA2 caller.
Field maxWorkspaceBytes#
pub maxWorkspaceBytes: usizeMaximum bytes allocated for probability tables, excluding caller-owned buffers.
Implementation DecodeLimits#
impl DecodeLimitsAssociated function make#
pub fn make() -> DecodeLimitsAllows 64 MiB input, 256 MiB output, a 64 MiB dictionary, and 16 MiB of tables.
DecodeReason#
pub enum DecodeReasonThe cause of a complete-buffer decoding failure.
InvalidHeader#
InvalidHeaderA container header or property byte is invalid.
InvalidData#
InvalidDataThe range coding or chunk control sequence is invalid.
InvalidDistance#
InvalidDistanceA match refers outside the dictionary or before its last reset.
InvalidSize#
InvalidSizeA declared compressed or uncompressed size does not match the data.
TruncatedInput#
TruncatedInputThe input ends before a complete stream is available.
TrailingData#
TrailingDataBytes follow the end of a stream where the format permits none.
ChecksumMismatch#
ChecksumMismatchA container checksum does not match its data.
UnsupportedFilter#
UnsupportedFilterThe XZ block uses a filter other than a single LZMA2 filter.
UnsupportedCheck#
UnsupportedCheckThe XZ stream uses a check other than none, CRC-32, CRC-64, or SHA-256.
InputLimit#
InputLimitThe supplied input exceeds the input limit.
OutputLimit#
OutputLimitThe decoded data exceeds the output buffer or output limit.
DictionaryLimit#
DictionaryLimitThe declared dictionary exceeds the dictionary limit.
WorkspaceLimit#
WorkspaceLimitProbability tables would exceed the workspace limit.
DecodeError#
pub struct DecodeErrorA failure with input and output offsets. Discard all output after a failure.
Field reason#
pub reason: DecodeReasonWhy decoding failed.
Field consumed#
pub consumed: usizeInput bytes consumed before failure.
Field written#
pub written: usizeOutput bytes written before failure; these bytes are not verified.
Implementation Debug for DecodeReason#
impl Debug for DecodeReasonOperation debug#
effect fn debug(self: &Self, formatter: &mut Formatter) -> ()
! WriterError
? &mut WriterWrites the symbolic reason for a decoding failure.
Implementation Debug for DecodeError#
impl Debug for DecodeErrorOperation debug#
effect fn debug(self: &Self, formatter: &mut Formatter) -> ()
! WriterError
? &mut WriterWrites the failure reason and progress offsets.
Decoded#
pub struct DecodedThe verified input and output lengths of a successful complete decode.
Field consumed#
pub consumed: usizeCompressed bytes consumed.
Field written#
pub written: usizeDecoded bytes written at the start of the supplied output buffer.
Category: Data formats.
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, wasm32-wasip1, wasm32-wasip2.