pub struct TokenRecord { /* private fields */ }Expand description
Binary representation of a token.
The text itself is stored separately inside the token string table.
offset is relative to the beginning of that section.
Binary layout:
- token id: 4 bytes
- reserved: 4 bytes
- string offset: 8 bytes
- string length: 4 bytes
- reserved: 4 bytes
Implementations§
Source§impl TokenRecord
impl TokenRecord
pub const SIZE: usize = TOKEN_RECORD_SIZE
pub const fn new(id: u32, offset: u64, length: u32) -> Self
pub const fn id(self) -> u32
pub const fn offset(self) -> u64
pub const fn length(self) -> u32
pub const fn end(self) -> u64
pub fn encode(self) -> [u8; 24]
pub fn decode(bytes: &[u8]) -> Result<Self, FormatError>
Trait Implementations§
Source§impl BinaryRecord for TokenRecord
impl BinaryRecord for TokenRecord
Source§impl Clone for TokenRecord
impl Clone for TokenRecord
Source§fn clone(&self) -> TokenRecord
fn clone(&self) -> TokenRecord
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for TokenRecord
Source§impl Debug for TokenRecord
impl Debug for TokenRecord
impl Eq for TokenRecord
Source§impl PartialEq for TokenRecord
impl PartialEq for TokenRecord
impl StructuralPartialEq for TokenRecord
Auto Trait Implementations§
impl Freeze for TokenRecord
impl RefUnwindSafe for TokenRecord
impl Send for TokenRecord
impl Sync for TokenRecord
impl Unpin for TokenRecord
impl UnsafeUnpin for TokenRecord
impl UnwindSafe for TokenRecord
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