Struct cranelift_module::ModuleDeclarations

source ·
pub struct ModuleDeclarations { /* private fields */ }
Expand description

This provides a view to the state of a module which allows ir::ExternalNames to be translated into FunctionDeclarations and DataDeclarations.

Implementations§

source§

impl ModuleDeclarations

source

pub fn get_name(&self, name: &str) -> Option<FuncOrDataId>

Get the module identifier for a given name, if that name has been declared.

source

pub fn get_functions( &self ) -> impl Iterator<Item = (FuncId, &FunctionDeclaration)>

Get an iterator of all function declarations

source

pub fn is_function(name: &ModuleRelocTarget) -> bool

Return whether name names a function, rather than a data object.

source

pub fn get_function_decl(&self, func_id: FuncId) -> &FunctionDeclaration

Get the FunctionDeclaration for the function named by name.

source

pub fn get_data_objects( &self ) -> impl Iterator<Item = (DataId, &DataDeclaration)>

Get an iterator of all data declarations

source

pub fn get_data_decl(&self, data_id: DataId) -> &DataDeclaration

Get the DataDeclaration for the data object named by name.

source

pub fn declare_function( &mut self, name: &str, linkage: Linkage, signature: &Signature ) -> ModuleResult<(FuncId, Linkage)>

Declare a function in this module.

source

pub fn declare_anonymous_function( &mut self, signature: &Signature ) -> ModuleResult<FuncId>

Declare an anonymous function in this module.

source

pub fn declare_data( &mut self, name: &str, linkage: Linkage, writable: bool, tls: bool ) -> ModuleResult<(DataId, Linkage)>

Declare a data object in this module.

source

pub fn declare_anonymous_data( &mut self, writable: bool, tls: bool ) -> ModuleResult<DataId>

Declare an anonymous data object in this module.

Trait Implementations§

source§

impl Debug for ModuleDeclarations

source§

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

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

impl Default for ModuleDeclarations

source§

fn default() -> ModuleDeclarations

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

Auto Trait Implementations§

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>,

§

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>,

§

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.