Struct wrapped_mono::Class
source · pub struct Class { /* private fields */ }
Expand description
Safe representation of a managed class.(eg. System.Int64, System.Object, etc.);
Implementations§
source§impl Class
impl Class
sourcepub fn get_ptr(&self) -> *mut MonoClass
pub fn get_ptr(&self) -> *mut MonoClass
Returns copy of internal pointer representing [MonoClass
].
sourcepub fn from_name(image: &Image, namespace: &str, name: &str) -> Option<Self>
pub fn from_name(image: &Image, namespace: &str, name: &str) -> Option<Self>
Returns class named name in namespace in image image. Is not case sensitive!
Arguments
Name | Type | Description |
---|---|---|
image | &Image | image to load class from |
namespace | &str | path to namespace this class is in |
name | &str | name of class to get |
Example
// Not case sensitive!
let some_class = Class::from_name(&some_image,"SyStem","tyPe").expect("Could not find a class!");
sourcepub fn from_name_case(
image: &Image,
namespace: &str,
name: &str
) -> Option<Self>
pub fn from_name_case( image: &Image, namespace: &str, name: &str ) -> Option<Self>
Returns class named name in namespace in image image. It is case sensitive.
Arguments
Name | Type | Description |
---|---|---|
image | &Image | image to load class from |
namespace | &str | path to namespace this class is in |
name | &str | name of class to get |
Example
let some_class = Class::from_name_case(&some_image,"System","Type").expect("Could not find a class!");
sourcepub fn get_field_from_name(&self, name: &str) -> Option<ClassField>
pub fn get_field_from_name(&self, name: &str) -> Option<ClassField>
sourcepub fn array_element_size(&self) -> i32
pub fn array_element_size(&self) -> i32
Returns amount of memory occupied by object when inside array.
sourcepub fn get_interfaces(&self) -> Vec<Self>
pub fn get_interfaces(&self) -> Vec<Self>
Gets a Vec
containing all interfaces this class implements.
sourcepub fn get_namespace(&self) -> String
pub fn get_namespace(&self) -> String
Gets namespace this class is in, or “” string if it is not in any namespace.
sourcepub fn get_nesting_type(&self) -> Option<Self>
pub fn get_nesting_type(&self) -> Option<Self>
Gets class this class is nested in, or None
if it is not nested in any type.
sourcepub fn get_parent(&self) -> Option<Self>
pub fn get_parent(&self) -> Option<Self>
sourcepub fn get_element_class(&self) -> Self
pub fn get_element_class(&self) -> Self
Get element class of an array. self must be an array type, otherwise returns self.
sourcepub fn implements_interface(&self, iface: &Self) -> bool
pub fn implements_interface(&self, iface: &Self) -> bool
Returns if class implements interface iface.
sourcepub fn is_assignable_from(&self, other: &Self) -> bool
pub fn is_assignable_from(&self, other: &Self) -> bool
Returns true if object of type other can be assigned to class self.
sourcepub fn is_delegate(&self) -> bool
pub fn is_delegate(&self) -> bool
Checks if self represents a delegate type.
sourcepub fn num_fields(&self) -> i32
pub fn num_fields(&self) -> i32
Gets amount of static and instance files of class
sourcepub fn num_methods(&self) -> i32
pub fn num_methods(&self) -> i32
Gets amount of methods in the class self
sourcepub fn num_properties(&self) -> i32
pub fn num_properties(&self) -> i32
Gets number of properties in the class(getters,setters,indexers)
sourcepub fn is_valuetype(&self) -> bool
pub fn is_valuetype(&self) -> bool
Checks if self represents a value type.
sourcepub fn get_object() -> Self
pub fn get_object() -> Self
Returns Class
representing System.Object
type.
sourcepub fn get_int_16() -> Self
pub fn get_int_16() -> Self
sourcepub fn get_int_32() -> Self
pub fn get_int_32() -> Self
sourcepub fn get_int_64() -> Self
pub fn get_int_64() -> Self
sourcepub fn get_double() -> Self
pub fn get_double() -> Self
sourcepub fn get_int_ptr() -> Self
pub fn get_int_ptr() -> Self
sourcepub fn get_single() -> Self
pub fn get_single() -> Self
sourcepub fn get_string() -> Self
pub fn get_string() -> Self
Returns Class
representing System.String
type.
sourcepub fn get_thread() -> Self
pub fn get_thread() -> Self
Returns Class
representing System.Threading.Thread
type.
sourcepub fn get_uint_16() -> Self
pub fn get_uint_16() -> Self
sourcepub fn get_uint_32() -> Self
pub fn get_uint_32() -> Self
sourcepub fn get_uint_64() -> Self
pub fn get_uint_64() -> Self
sourcepub fn get_uint_ptr() -> Self
pub fn get_uint_ptr() -> Self
sourcepub fn get_boolean() -> Self
pub fn get_boolean() -> Self
sourcepub fn get_array_class(&self, rank: u32) -> Self
pub fn get_array_class(&self, rank: u32) -> Self
Gets class of an array of class self with rank (for int and rank 1, returns int[], for byte and rank 3 returns byte[][][],etc.)
sourcepub fn get_exception_class() -> Self
pub fn get_exception_class() -> Self
Returns Class
representing the type System.Exception.
sourcepub fn get_delegate_class() -> Self
pub fn get_delegate_class() -> Self
Returns Class
representing the type System.Delegate.
sourcepub fn get_fields(&self) -> Vec<ClassField>
pub fn get_fields(&self) -> Vec<ClassField>
Returns all fields of a class
sourcepub fn get_field(&self, name: &str) -> Option<ClassField>
pub fn get_field(&self, name: &str) -> Option<ClassField>
Returns field with name name
sourcepub fn get_nested_types(&self) -> Vec<Self>
pub fn get_nested_types(&self) -> Vec<Self>
Gets all types nested inside this class.
sourcepub fn get_property_from_name(&self, name: &str) -> Option<ClassProperity>
pub fn get_property_from_name(&self, name: &str) -> Option<ClassProperity>
Returns property with name name or None
if it is not inside class.
sourcepub fn get_properities(&self) -> Vec<ClassProperity>
pub fn get_properities(&self) -> Vec<ClassProperity>
Returns all properties of class self.
sourcepub fn get_name_sig(&self) -> String
pub fn get_name_sig(&self) -> String
Returns for use in : “NAMESPACE.NAME”