Struct Function

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

A function.

Implementations§

Source§

impl<'input> Function<'input>

Source

pub fn id(&self) -> usize

The user defined id for this function.

Source

pub fn set_id(&self, id: usize)

Set a user defined id for this function.

Source

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

The namespace of the function.

Source

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

The name of the function.

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 function.

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

Source

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

The source information for the function.

Source

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

The address of the function.

Source

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

The size in bytes of the function.

This may exclude padding, and may be non-contiguous.

Source

pub fn ranges(&self) -> &[Range]

The address ranges of the function.

Source

pub fn is_inline(&self) -> bool

Return true if this is an inlined function.

Source

pub fn is_declaration(&self) -> bool

Return true if this is a declaration.

Source

pub fn parameters(&self) -> &[ParameterType<'input>]

The function parameter types.

Source

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

The return type.

Returns None if the return type is invalid.

Source

pub fn details(&self, hash: &FileHash<'input>) -> FunctionDetails<'input>

Extra function details.

Source

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

Compare the identifying information of two functions.

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

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

Trait Implementations§

Source§

impl<'input> Debug for Function<'input>

Source§

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

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

impl<'input> Default for Function<'input>

Source§

fn default() -> Function<'input>

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

Auto Trait Implementations§

§

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

§

impl<'input> RefUnwindSafe for Function<'input>

§

impl<'input> Send for Function<'input>

§

impl<'input> Sync for Function<'input>

§

impl<'input> Unpin for Function<'input>

§

impl<'input> UnwindSafe for Function<'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.