pub struct Decoder { /* private fields */ }Expand description
The Fast Static Symbol Table (FSST) decoder.
See module level documentations. Note that this struct contains a ~2KiB large array, and you may want to box it for fast moving.
Implementations§
Source§impl Decoder
impl Decoder
Sourcepub const MAX_SYMBOL_LEN: usize = 8usize
pub const MAX_SYMBOL_LEN: usize = 8usize
The max length of one symbol.
Sourcepub fn parse(bytes: &[u8]) -> Result<Self, Error>
pub fn parse(bytes: &[u8]) -> Result<Self, Error>
Parse the symbol table symtab, from the serialization format from libfstt.
This is re-implemented in Rust with the reference of
libfstt’s fsst_import.
Some notable differences:
- More error checking on short inputs, no buffer overflow, because we’re Rust.
- More permissive on version endianness. Allow both little and big endian versions. Symbols are still always little-endian, as upstream.
- Zero-terminated mode (NUL as the first symbol) is unsupported and rejected.
- Encoder state bytes are ignored.
- Trailing bytes are allowed but ignored.
License of libfstt: MIT License, Copyright 2018-2020, CWI, TU Munich, FSU Jena
§Errors
Returns None if the input cannot be successfully parsed.
Sourcepub fn max_decode_len(input_len: usize) -> usize
pub fn max_decode_len(input_len: usize) -> usize
Return the max possible decoded length of input_len length input.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Decoder
impl RefUnwindSafe for Decoder
impl Send for Decoder
impl Sync for Decoder
impl Unpin for Decoder
impl UnwindSafe for Decoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more