pub struct Symbol<'t> { /* private fields */ }
Expand description
Represents a symbol from the symbol table.
A Symbol
is represented internally as a &[u8]
, and in general the bytes inside are not
inspected in any way before calling any of the accessor methods.
To avoid copying, Symbol
s exist as references to data owned by the parent SymbolTable
.
Therefore, a Symbol
may not outlive its parent SymbolTable
.
Implementations
sourceimpl<'t> Symbol<'t>
impl<'t> Symbol<'t>
sourcepub fn index(&self) -> SymbolIndex
pub fn index(&self) -> SymbolIndex
The index of this symbol in the containing symbol stream.
sourcepub fn raw_kind(&self) -> SymbolKind
pub fn raw_kind(&self) -> SymbolKind
Returns the kind of symbol identified by this Symbol.
sourcepub fn raw_bytes(&self) -> &'t [u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
pub fn raw_bytes(&self) -> &'t [u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
Returns the raw bytes of this symbol record, including the symbol type and extra data, but not including the preceding symbol length indicator.
sourcepub fn parse(&self) -> Result<SymbolData<'t>>
pub fn parse(&self) -> Result<SymbolData<'t>>
Parse the symbol into the SymbolData
it contains.
sourcepub fn starts_scope(&self) -> bool
pub fn starts_scope(&self) -> bool
Returns whether this symbol starts a scope.
If true
, this symbol has a parent
and an end
field, which contains the offset of the
corrsponding end symbol.
sourcepub fn ends_scope(&self) -> bool
pub fn ends_scope(&self) -> bool
Returns whether this symbol declares the end of a scope.
Trait Implementations
impl<'t> Copy for Symbol<'t>
impl<'t> StructuralPartialEq for Symbol<'t>
Auto Trait Implementations
impl<'t> RefUnwindSafe for Symbol<'t>
impl<'t> Send for Symbol<'t>
impl<'t> Sync for Symbol<'t>
impl<'t> Unpin for Symbol<'t>
impl<'t> UnwindSafe for Symbol<'t>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more