pub struct Function { /* private fields */ }Expand description
Error reference class
Implementations§
Source§impl Function
impl Function
Sourcepub fn call_packed(&self, packed_args: &[AnyView<'_>]) -> Result<Any>
pub fn call_packed(&self, packed_args: &[AnyView<'_>]) -> Result<Any>
Call the function in packed format.
pub fn call_tuple<TupleType>(&self, tuple_args: TupleType) -> Result<Any>where
TupleType: TupleAsPackedArgs,
Sourcepub fn call_tuple_with_len<const LEN: usize, TupleType>(
&self,
tuple_args: TupleType,
) -> Result<Any>where
TupleType: TupleAsPackedArgs,
pub fn call_tuple_with_len<const LEN: usize, TupleType>(
&self,
tuple_args: TupleType,
) -> Result<Any>where
TupleType: TupleAsPackedArgs,
Sourcepub fn get_global(name: &str) -> Result<Function>
pub fn get_global(name: &str) -> Result<Function>
Sourcepub fn from_type_method(type_index: i32, method_name: &str) -> Result<Function>
pub fn from_type_method(type_index: i32, method_name: &str) -> Result<Function>
Look up a reflected method of a type by type index and method name
Methods registered through the C++ reflection registry
(refl::ObjectDef<T>().def(...)) live in the per-type method table
rather than the global function table. Constructors registered via
refl::init are reachable under the reserved name __ffi_init__.
For instance methods, the first packed argument is the object itself.
type_index must be a registered type index (e.g. obtained from a
live object via Any::type_index or from a type key); the underlying
C API treats an unregistered index as a fatal error.
§Arguments
type_index- The type index of the type that owns the methodmethod_name- The name of the method
§Returns
Function- The reflected method
Sourcepub fn from_type_attr(type_index: i32, attr_name: &str) -> Result<Function>
pub fn from_type_attr(type_index: i32, attr_name: &str) -> Result<Function>
Look up a function-valued attribute for a concrete runtime type.
Type attributes are not inherited from base types.
Sourcepub fn from_type_key_method(
type_key: &str,
method_name: &str,
) -> Result<Function>
pub fn from_type_key_method( type_key: &str, method_name: &str, ) -> Result<Function>
Look up a reflected method of a type by type key and method name
Same as Function::from_type_method, but resolves type_key to a
type index first.
§Arguments
type_key- The type key of the type that owns the methodmethod_name- The name of the method
§Returns
Function- The reflected method
Sourcepub fn from_packed<F>(func: F) -> Self
pub fn from_packed<F>(func: F) -> Self
Sourcepub fn from_typed<F, I, O>(func: F) -> Selfwhere
F: AsPackedCallable<I, O> + 'static,
pub fn from_typed<F, I, O>(func: F) -> Selfwhere
F: AsPackedCallable<I, O> + 'static,
Sourcepub unsafe fn from_extern_c(
handle: *mut c_void,
safe_call: TVMFFISafeCallType,
deleter: Option<unsafe extern "C" fn(*mut c_void)>,
) -> Self
pub unsafe fn from_extern_c( handle: *mut c_void, safe_call: TVMFFISafeCallType, deleter: Option<unsafe extern "C" fn(*mut c_void)>, ) -> Self
§Safety
handle must be a valid pointer (or null) that is compatible with
safe_call and deleter. The caller must ensure the handle outlives
the returned Function (or that deleter properly frees it).
Trait Implementations§
Source§impl AnyCompatible for Function
impl AnyCompatible for Function
Source§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§impl ArgIntoRef for Function
impl ArgIntoRef for Function
Source§impl<'a> ArgIntoRef for &'a Function
impl<'a> ArgIntoRef for &'a Function
Source§impl IntoArgHolder for Function
impl IntoArgHolder for Function
Source§impl<'a> IntoArgHolder for &'a Function
impl<'a> IntoArgHolder for &'a Function
Source§impl ObjectRefCore for Function
impl ObjectRefCore for Function
type ContainerType = <ObjectArc<FunctionObj> 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
Auto Trait Implementations§
impl Freeze for Function
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnsafeUnpin for Function
impl UnwindSafe for Function
Blanket Implementations§
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>where
B: ObjectRefCore + AnyCompatible,
fn try_cast<B>(self) -> Result<B>where
B: ObjectRefCore + AnyCompatible,
self and rewrap the underlying object as B without copying.