pub struct Symbol(/* private fields */);Expand description
Symbols are small (up to 8-byte) segments of strings, stored in a Compressor and
identified by an 8-bit code.
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub fn len(self) -> usize
pub fn len(self) -> usize
Calculate the length of the symbol in bytes. Always a value between 1 and 8.
Each symbol has the capacity to hold up to 8 bytes of data, but the symbols
can contain fewer bytes, padded with 0x00. There is a special case of a symbol
that holds the byte 0x00. In that case, the symbol contains 0x0000000000000000
but we want to interpret that as a one-byte symbol containing 0x00.
Sourcepub fn first_byte(self) -> u8
pub fn first_byte(self) -> u8
Get the first byte of the symbol as a u8.
If the symbol is empty, this will return the zero byte.
Sourcepub fn first2(self) -> u16
pub fn first2(self) -> u16
Get the first two bytes of the symbol as a u16.
If the Symbol is one or zero bytes, this will return 0u16.
Trait Implementations§
impl Copy for Symbol
impl Eq for Symbol
impl StructuralPartialEq for Symbol
Auto Trait Implementations§
impl Freeze for Symbol
impl RefUnwindSafe for Symbol
impl Send for Symbol
impl Sync for Symbol
impl Unpin for Symbol
impl UnwindSafe for Symbol
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