pub struct Module { /* private fields */ }Expand description
A collection of functions, such as a dynamic library, passed across
languages as ffi.Module.
Implementations§
Source§impl Module
impl Module
Sourcepub fn get_function<Str: AsRef<str>>(&self, name: Str) -> Result<Function>
pub fn get_function<Str: AsRef<str>>(&self, name: Str) -> Result<Function>
Look up a function of the module by name.
Only this module is searched, not the modules it imports.
§Arguments
name- The name of the function.
§Returns
The function.
§Errors
Returns a ValueError naming the function if the module has no function
name, as Function::get_global does for a missing global function.
Sourcepub fn get_function_with_imports<Str: AsRef<str>>(
&self,
name: Str,
) -> Result<Function>
pub fn get_function_with_imports<Str: AsRef<str>>( &self, name: Str, ) -> Result<Function>
As get_function, but also searching the modules
this one imports, depth first in import order.
Sourcepub fn implements_function_with_imports<Str: AsRef<str>>(
&self,
name: Str,
) -> Result<bool>
pub fn implements_function_with_imports<Str: AsRef<str>>( &self, name: Str, ) -> Result<bool>
As implements_function, but also searching the modules
this one imports, depth first in import order.
Sourcepub fn get_function_metadata<Str: AsRef<str>>(
&self,
name: Str,
) -> Result<Option<String>>
pub fn get_function_metadata<Str: AsRef<str>>( &self, name: Str, ) -> Result<Option<String>>
Get the metadata of a function the module exports.
Only this module is searched, not the modules it imports.
The metadata is a JSON object whose type_schema entry is the
function’s signature, as an export with metadata enabled records it
(see tvm_ffi_dll_export_typed_func!).
§Arguments
name- The name of the function.
§Returns
The metadata as a JSON string, or None if the function has none.
Sourcepub fn get_function_metadata_with_imports<Str: AsRef<str>>(
&self,
name: Str,
) -> Result<Option<String>>
pub fn get_function_metadata_with_imports<Str: AsRef<str>>( &self, name: Str, ) -> Result<Option<String>>
As get_function_metadata, but also searching the modules
this one imports, depth first in import order.
Sourcepub fn get_function_doc<Str: AsRef<str>>(
&self,
name: Str,
) -> Result<Option<String>>
pub fn get_function_doc<Str: AsRef<str>>( &self, name: Str, ) -> Result<Option<String>>
Get the doc string of a function the module exports.
Only this module is searched, not the modules it imports.
The doc string is the one the export recorded (see
tvm_ffi_dll_export_typed_func_doc!).
§Arguments
name- The name of the function.
§Returns
The doc string, or None if the function has none.
Sourcepub fn get_function_doc_with_imports<Str: AsRef<str>>(
&self,
name: Str,
) -> Result<Option<String>>
pub fn get_function_doc_with_imports<Str: AsRef<str>>( &self, name: Str, ) -> Result<Option<String>>
As get_function_doc, but also searching the modules
this one imports, depth first in import order.
Trait Implementations§
Source§impl DowncastRefFromAny for Module
impl DowncastRefFromAny for Module
Source§impl ObjectRefAnyCompatible for Module
impl ObjectRefAnyCompatible for Module
Source§fn extra_check(obj: &Self::ContainerType) -> bool
fn extra_check(obj: &Self::ContainerType) -> bool
obj, an instance of ContainerType, is a value of Self.
Every strict and converting cast checks it, after the object type.Source§fn convert_fallback(value: AnyView<'_>) -> Option<Self>
fn convert_fallback(value: AnyView<'_>) -> Option<Self>
Self object, such as an integer that
stands for a constant; None rejects it. Only converting casts (TryFrom<Any>,
typed function arguments) call it; downcast_ref, downcast and
match_any! never do.Source§fn custom_type_str() -> String
fn custom_type_str() -> String
AnyCompatible::type_str.Source§fn custom_mismatch_type_info(value: AnyView<'_>) -> String
fn custom_mismatch_type_info(value: AnyView<'_>) -> String
value in conversion errors; by default its
runtime type key. See AnyCompatible::get_mismatch_type_info.Source§impl ObjectRefCore for Module
impl ObjectRefCore for Module
Source§type ContainerType = ModuleObj
type ContainerType = ModuleObj
Source§fn data(this: &Self) -> &ObjectArc<Self::ContainerType>
fn data(this: &Self) -> &ObjectArc<Self::ContainerType>
Source§fn into_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: ObjectRefCore>(&self, other: &Other) -> bool
fn same_as<Other: ObjectRefCore>(&self, other: &Other) -> bool
Source§fn type_key(&self) -> &'static str
fn type_key(&self) -> &'static str
"ffi.Array", as C++ ObjectRef::GetTypeKey.Source§fn is<T: AnyCompatible>(&self) -> bool
fn is<T: AnyCompatible>(&self) -> bool
T as is, such as a subtype or a container
whose elements are checked too, by the strict check of
downcast, without a reference count change.
See also crate::Any::is.Source§impl PackedCallArg for Module
impl PackedCallArg for Module
Source§impl<'a> PackedCallArg for &'a Module
impl<'a> PackedCallArg for &'a Module
impl TypeSubsumes<Module> for ObjectRef
Auto Trait Implementations§
impl !Send for Module
impl !Sync for Module
impl Forget for Module
impl Freeze for Module
impl Move for Module
impl RefUnwindSafe for Module
impl Unpin for Module
impl UnsafeUnpin for Module
impl UnwindSafe for Module
Blanket Implementations§
Source§impl<T> AnyCompatible for Twhere
T: ObjectRefAnyCompatible,
impl<T> AnyCompatible for Twhere
T: ObjectRefAnyCompatible,
const MATCH_ANY_EXACT: bool = const MATCH_ANY_EXACT: bool = <T as ObjectRefAnyCompatible>::MATCH_ANY_EXACT && <T::ContainerType as ObjectCore>::TYPE_FINAL;
fn match_any_exact_type_index() -> i32
Source§unsafe fn is_undefined(field: *const T) -> bool
unsafe fn is_undefined(field: *const T) -> 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. An undefined field
is no value; a nullable reference is Option<T>, whose None is a
defined value. Read moreSource§unsafe fn copy_to_any_view(src: &T, data: &mut TVMFFIAny)
unsafe fn copy_to_any_view(src: &T, data: &mut TVMFFIAny)
Source§unsafe fn move_to_any(src: T, data: &mut TVMFFIAny)
unsafe fn move_to_any(src: T, data: &mut TVMFFIAny)
Source§unsafe fn check_any_strict(data: &TVMFFIAny) -> bool
unsafe fn check_any_strict(data: &TVMFFIAny) -> bool
Source§unsafe fn copy_from_any_view_after_check(data: &TVMFFIAny) -> T
unsafe fn copy_from_any_view_after_check(data: &TVMFFIAny) -> T
Self out of a cell that holds one, retaining any object. Read moreSource§unsafe fn move_from_any_after_check(data: &mut TVMFFIAny) -> T
unsafe fn move_from_any_after_check(data: &mut TVMFFIAny) -> T
Self out of an owning cell that holds one. Read moreSource§unsafe fn try_cast_from_any_view(data: &TVMFFIAny) -> Result<T, ()>
unsafe fn try_cast_from_any_view(data: &TVMFFIAny) -> Result<T, ()>
data into a Self by the FFI rules, such as an integer into a
float; Err if it does not convert. Read moreSource§fn get_mismatch_type_info(data: &TVMFFIAny) -> String
fn get_mismatch_type_info(data: &TVMFFIAny) -> String
data in conversion errors; by
default its runtime type key.Source§fn type_str() -> String
fn type_str() -> String
int,
ffi.String or Array<int>.