pub struct SymbolId(/* private fields */);Expand description
The identity of a symbol within its Object: its position in Object::symbols.
Ids are dense, starting at zero in the order symbols were added.
§Examples
use object_lang::{Architecture, Object, Symbol};
let mut obj = Object::relocatable(Architecture::X86_64);
let puts = obj.add_symbol(Symbol::undefined("puts"));
assert_eq!(obj.symbols()[puts.index()].name, "puts");Implementations§
Source§impl SymbolId
impl SymbolId
Sourcepub const fn new(index: u32) -> Self
pub const fn new(index: u32) -> Self
The id of the symbol at position index in Object::symbols. As with
SectionId::new, an id that names no symbol is caught by Object::validate.
§Examples
use object_lang::{Architecture, Object, Symbol, SymbolId};
let mut obj = Object::relocatable(Architecture::X86_64);
let exit = obj.add_symbol(Symbol::undefined("exit"));
assert_eq!(SymbolId::new(0), exit);Sourcepub const fn index(self) -> usize
pub const fn index(self) -> usize
The position of the symbol in Object::symbols.
§Examples
use object_lang::{Architecture, Object, Symbol};
let mut obj = Object::relocatable(Architecture::X86_64);
let first = obj.add_symbol(Symbol::undefined("a"));
assert_eq!(first.index(), 0);Trait Implementations§
impl Copy for SymbolId
impl Eq for SymbolId
Source§impl Ord for SymbolId
impl Ord for SymbolId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for SymbolId
impl PartialOrd for SymbolId
impl StructuralPartialEq for SymbolId
Auto Trait Implementations§
impl Freeze for SymbolId
impl RefUnwindSafe for SymbolId
impl Send for SymbolId
impl Sync for SymbolId
impl Unpin for SymbolId
impl UnsafeUnpin for SymbolId
impl UnwindSafe for SymbolId
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