Struct wrapped_mono::Method
source · pub struct Method<Args: InteropSend + CompareClasses>where
<Args as InteropSend>::TargetType: TupleToPtrs,{ /* private fields */ }
Expand description
Rust representation of a managed method(function of code loaded into mono runtime). Args - Tuple type of types of all arguments accepted by this particular method.
Implementations§
source§impl<Args: InteropSend + CompareClasses> Method<Args>where
<Args as InteropSend>::TargetType: TupleToPtrs,
impl<Args: InteropSend + CompareClasses> Method<Args>where <Args as InteropSend>::TargetType: TupleToPtrs,
Trait implemented only for Method
type. Spiliting it from main Method
type allows for different amount of method arguments.
sourcepub fn can_acces_method<T: InteropSend + CompareClasses>(
&self,
called: &Method<T>
) -> boolwhere
<T as InteropSend>::TargetType: TupleToPtrs,
pub fn can_acces_method<T: InteropSend + CompareClasses>( &self, called: &Method<T> ) -> boolwhere <T as InteropSend>::TargetType: TupleToPtrs,
sourcepub fn get_param_count(&self) -> u32
pub fn get_param_count(&self) -> u32
sourcepub fn get_param_names(&self) -> Vec<String>
pub fn get_param_names(&self) -> Vec<String>
sourcepub fn get_params(&self) -> Vec<Class>
pub fn get_params(&self) -> Vec<Class>
sourcepub fn get_return(&self) -> Class
pub fn get_return(&self) -> Class
source§impl<Args: InteropSend + CompareClasses> Method<Args>where
<Args as InteropSend>::TargetType: TupleToPtrs,
impl<Args: InteropSend + CompareClasses> Method<Args>where <Args as InteropSend>::TargetType: TupleToPtrs,
sourcepub fn invoke(
&self,
object: Option<Object>,
args: Args
) -> Result<Option<Object>, Exception>
pub fn invoke( &self, object: Option<Object>, args: Args ) -> Result<Option<Object>, Exception>
Invoke this method on object object
with arguments args
Arguments
Name | Type | Description |
---|---|---|
self | &Self | Reference to method to invoke. |
object | Option<Object> | Object to invoke method on. Pass None if method is static. |
args | Args | Arguments to pass to method |
Errors
Returns an exception if it was thrown by managed code.
sourcepub unsafe fn from_ptr(met_ptr: *mut MonoMethod) -> Option<Self>
pub unsafe fn from_ptr(met_ptr: *mut MonoMethod) -> Option<Self>
Creates new Method type from a [*mut MonoMethod
], checks if arguments of [MonoMethod
] and rust representation of a Method
match and if not, returns None
.
Returns None
if pointer is null or if method pointer points to has different signature.
Arguments
Name | Type | Description |
---|---|---|
met_ptr | *mut [MonoMethod ] | Pointer to method to create a representation for. |
Safety
Pointer must be either a valid pointer to [MonoMethod
] recived from mono runtime, or a null pointer.
sourcepub unsafe fn from_ptr_checked(met_ptr: *mut MonoMethod) -> Option<Self>
pub unsafe fn from_ptr_checked(met_ptr: *mut MonoMethod) -> Option<Self>
Creates new Method type from a [*mut MonoMethod
], checks if arguments of [MonoMethod
] and rust representation of a Method
match and returns None
if so.
Returns None
if pointer is null.
Arguments
Name | Type | Description |
---|---|---|
met_ptr | *mut [MonoMethod ] | Pointer to method to create a representation for. |
Safety
Pointer must be either a valid pointer to [MonoMethod
] recived from mono runtime, or a null pointer.