Struct Variable

Source
pub struct Variable<'input> { /* private fields */ }
Expand description

A global variable.

Implementations§

Source§

impl<'input> Variable<'input>

Source

pub fn id(&self) -> usize

The user defined id for this variable.

Source

pub fn set_id(&self, id: usize)

Set a user defined id for this variable.

Source

pub fn namespace(&self) -> Option<&Namespace<'_>>

The namespace of the variable.

Source

pub fn name(&self) -> Option<&str>

The name of the variable.

Source

pub fn linkage_name(&self) -> Option<&str>

The linkage name of the variable.

Source

pub fn symbol_name(&self) -> Option<&str>

The symbol name of the variable.

This is determined from a symbol table entry with a matching address.

Source

pub fn ty<'a>( &self, hash: &'a FileHash<'input>, ) -> Option<Cow<'a, Type<'input>>>

The type of the variable.

Returns None if the type is invalid.

Source

pub fn source(&self) -> &Source<'input>

The source information for the variable.

Source

pub fn address(&self) -> Option<u64>

The address of the variable.

Source

pub fn byte_size(&self, hash: &FileHash<'_>) -> Option<u64>

The size in bytes of the variable.

Source

pub fn range(&self, hash: &FileHash<'_>) -> Option<Range>

The address range of the variable.

Source

pub fn is_declaration(&self) -> bool

Return true if this is a declaration.

Source

pub fn cmp_id( _hash_a: &FileHash<'_>, a: &Variable<'_>, _hash_b: &FileHash<'_>, b: &Variable<'_>, ) -> Ordering

Compare the identifying information of two variables.

Variables are equal if they have the same namespace and name.

This can be used to sort, and to determine if two variables refer to the same definition (even if there are differences in the definitions).

Trait Implementations§

Source§

impl<'input> Debug for Variable<'input>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'input> Default for Variable<'input>

Source§

fn default() -> Variable<'input>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'input> !Freeze for Variable<'input>

§

impl<'input> RefUnwindSafe for Variable<'input>

§

impl<'input> Send for Variable<'input>

§

impl<'input> Sync for Variable<'input>

§

impl<'input> Unpin for Variable<'input>

§

impl<'input> UnwindSafe for Variable<'input>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.