#[repr(C)]pub struct IRModule { /* private fields */ }Implementations§
Source§impl IRModule
impl IRModule
Sourcepub fn from_functions(
functions: &Map<GlobalVar, BaseFunc>,
attrs: Option<&DictAttrs>,
global_infos: &Map<String, Array<GlobalInfo>>,
) -> Result<Self>
pub fn from_functions( functions: &Map<GlobalVar, BaseFunc>, attrs: Option<&DictAttrs>, global_infos: &Map<String, Array<GlobalInfo>>, ) -> Result<Self>
The module of functions, with the attributes attrs (empty if None) and the
module-level information global_infos; it indexes the functions by name, which must be
distinct (C++ IRModule(functions, attrs, global_infos)).
Sourcepub fn from_expr(
expr: impl IntoExpr,
functions: &Map<GlobalVar, BaseFunc>,
) -> Result<Self>
pub fn from_expr( expr: impl IntoExpr, functions: &Map<GlobalVar, BaseFunc>, ) -> Result<Self>
The module of functions and expr, a function bound to its global symbol or to main
(ir.IRModuleFromExpr).
Sourcepub fn shallow_copy(&self) -> Result<Self>
pub fn shallow_copy(&self) -> Result<Self>
A copy of the module that shares its functions (ir.IRModuleClone).
Sourcepub fn add(
&self,
var: impl Into<GlobalVar>,
func: impl Into<BaseFunc>,
update: bool,
) -> Result<()>
pub fn add( &self, var: impl Into<GlobalVar>, func: impl Into<BaseFunc>, update: bool, ) -> Result<()>
Add func as var, replacing an existing definition; the native side currently ignores
update (ir.IRModuleAdd).
Sourcepub fn remove(&self, name: &str) -> Result<()>
pub fn remove(&self, name: &str) -> Result<()>
Remove the function named name (ir.IRModuleRemove).
Sourcepub fn remove_global_var(&self, var: impl Into<GlobalVar>) -> Result<()>
pub fn remove_global_var(&self, var: impl Into<GlobalVar>) -> Result<()>
Remove the function of var (ir.IRModuleRemove).
Sourcepub fn contains(&self, name: &str) -> Result<bool>
pub fn contains(&self, name: &str) -> Result<bool>
Whether the module has a global variable named name (ir.IRModuleContains).
Sourcepub fn contains_global_var(&self, var: impl Into<GlobalVar>) -> Result<bool>
pub fn contains_global_var(&self, var: impl Into<GlobalVar>) -> Result<bool>
Whether the module defines a function for var (ir.IRModuleContains).
Sourcepub fn has_global_var(&self, name: &str) -> Result<bool>
pub fn has_global_var(&self, name: &str) -> Result<bool>
Whether the module has a global variable named name (ir.IRModuleContainGlobalVar).
Sourcepub fn get_global_var(&self, name: &str) -> Result<GlobalVar>
pub fn get_global_var(&self, name: &str) -> Result<GlobalVar>
The global variable named name; fails if there is none (ir.IRModuleGetGlobalVar).
Sourcepub fn get_global_vars(&self) -> Result<Array<GlobalVar>>
pub fn get_global_vars(&self) -> Result<Array<GlobalVar>>
The global variables of the module, sorted by name (ir.IRModuleGetGlobalVars).
Sourcepub fn lookup(&self, var: impl Into<GlobalVar>) -> Result<BaseFunc>
pub fn lookup(&self, var: impl Into<GlobalVar>) -> Result<BaseFunc>
The function of var; fails if there is none (ir.IRModuleLookup).
Sourcepub fn lookup_name(&self, name: &str) -> Result<BaseFunc>
pub fn lookup_name(&self, name: &str) -> Result<BaseFunc>
The function named name; fails if there is none (ir.IRModuleLookupStr).
Sourcepub fn update(&self, other: &IRModule) -> Result<()>
pub fn update(&self, other: &IRModule) -> Result<()>
Add or replace the functions of other in the module (ir.IRModuleUpdate).
Sourcepub fn update_func(
&self,
var: impl Into<GlobalVar>,
func: impl Into<BaseFunc>,
) -> Result<()>
pub fn update_func( &self, var: impl Into<GlobalVar>, func: impl Into<BaseFunc>, ) -> Result<()>
Set the function of var to func (ir.IRModuleUpdateFunction).
Sourcepub fn update_global_info(
&self,
name: &str,
global_info: impl IntoIterator<Item = impl Into<GlobalInfo>>,
) -> Result<()>
pub fn update_global_info( &self, name: &str, global_info: impl IntoIterator<Item = impl Into<GlobalInfo>>, ) -> Result<()>
Set the module-level information name to global_info
(ir.IRModuleUpdateGlobalInfo).
Sourcepub fn get_attr(&self, key: &str) -> Result<Option<Any>>
pub fn get_attr(&self, key: &str) -> Result<Option<Any>>
The attribute key of the module, if set (ir.IRModuleGetAttr).
Sourcepub fn with_attr(self, key: &str, value: impl Into<Any>) -> Result<IRModule>
pub fn with_attr(self, key: &str, value: impl Into<Any>) -> Result<IRModule>
The module with the attribute key set to value (ir.IRModuleWithAttr).
Consumes self: the module is updated in place when this was its only handle, and copied
otherwise.
Sourcepub fn with_attrs(self, attrs: &Map<String, Any>) -> Result<IRModule>
pub fn with_attrs(self, attrs: &Map<String, Any>) -> Result<IRModule>
The module with the attributes of attrs set (ir.IRModuleWithAttrs).
Consumes self, as IRModule::with_attr does.
Sourcepub fn without_attr(self, key: &str) -> Result<IRModule>
pub fn without_attr(self, key: &str) -> Result<IRModule>
The module without the attribute key (ir.IRModuleWithoutAttr).
Consumes self, as IRModule::with_attr does.
Trait Implementations§
Source§impl AnyCompatible for IRModule
impl AnyCompatible for IRModule
Source§unsafe fn is_undefined(field: *const Self) -> bool
unsafe fn is_undefined(field: *const Self) -> bool
field, which holds a value of this type or all-zero bytes,
holds all-zero bytes that are no value of this type, as a null object
reference, a string of type index None or a zero device type: a field
that a creator left undefined for reflection to set, as C++ UnsafeInit
leaves a reference undefined (null). Unlike a C++ undefined reference,
it is no value; a nullable reference is Option<T>, whose None is a
defined value. Read moreSource§unsafe fn copy_to_any_view(src: &Self, data: &mut TVMFFIAny)
unsafe fn copy_to_any_view(src: &Self, data: &mut TVMFFIAny)
unsafe fn check_any_strict(data: &TVMFFIAny) -> bool
Source§unsafe fn copy_from_any_view_after_check(data: &TVMFFIAny) -> Self
unsafe fn copy_from_any_view_after_check(data: &TVMFFIAny) -> Self
Source§unsafe fn move_to_any(src: Self, data: &mut TVMFFIAny)
unsafe fn move_to_any(src: Self, data: &mut TVMFFIAny)
Source§unsafe fn move_from_any_after_check(data: &mut TVMFFIAny) -> Self
unsafe fn move_from_any_after_check(data: &mut TVMFFIAny) -> Self
Source§unsafe fn try_cast_from_any_view(data: &TVMFFIAny) -> Result<Self, ()>
unsafe fn try_cast_from_any_view(data: &TVMFFIAny) -> Result<Self, ()>
Source§fn get_mismatch_type_info(data: &TVMFFIAny) -> String
fn get_mismatch_type_info(data: &TVMFFIAny) -> String
Source§fn type_schema() -> String
fn type_schema() -> String
TypeTraits<T>::TypeSchema writes, which the type schemas of functions
and fields embed. Read moreSource§impl<'a> ArgIntoRef for &'a IRModule
impl<'a> ArgIntoRef for &'a IRModule
Source§impl ArgIntoRef for IRModule
impl ArgIntoRef for IRModule
Source§impl Deref for IRModule
impl Deref for IRModule
Source§type Target = IRModuleObj
type Target = IRModuleObj
Source§fn deref(&self) -> &IRModuleObj
fn deref(&self) -> &IRModuleObj
Source§impl<'a> IntoArgHolder for &'a IRModule
impl<'a> IntoArgHolder for &'a IRModule
Source§impl IntoArgHolder for IRModule
impl IntoArgHolder for IRModule
Source§impl ObjectRefCore for IRModule
impl ObjectRefCore for IRModule
type ContainerType = <ObjectArc<IRModuleObj> as Deref>::Target
fn data(this: &Self) -> &ObjectArc<Self::ContainerType>
fn into_data(this: Self) -> ObjectArc<Self::ContainerType>
Source§unsafe fn from_data(data: ObjectArc<Self::ContainerType>) -> Self
unsafe fn from_data(data: ObjectArc<Self::ContainerType>) -> Self
Source§fn same_as<Other>(&self, other: &Other) -> boolwhere
Other: ObjectRefCore,
fn same_as<Other>(&self, other: &Other) -> boolwhere
Other: ObjectRefCore,
Source§fn downcast_ref<T>(&self) -> Option<&T>where
T: ObjectCore,
fn downcast_ref<T>(&self) -> Option<&T>where
T: ObjectCore,
Auto Trait Implementations§
impl Freeze for IRModule
impl RefUnwindSafe for IRModule
impl !Send for IRModule
impl !Sync for IRModule
impl Unpin for IRModule
impl UnwindSafe for IRModule
Blanket Implementations§
Source§impl<T> ArgType for Twhere
T: ObjectRefCore + AnyCompatible + 'static,
impl<T> ArgType for Twhere
T: ObjectRefCore + AnyCompatible + 'static,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ObjectRefCast for Twhere
T: ObjectRefCore + AnyCompatible,
impl<T> ObjectRefCast for Twhere
T: ObjectRefCore + AnyCompatible,
Source§fn try_cast<B>(self) -> Result<B, Error>where
B: ObjectRefCore + AnyCompatible,
fn try_cast<B>(self) -> Result<B, Error>where
B: ObjectRefCore + AnyCompatible,
self and rewrap the underlying object as B without copying.