mod array;
mod assembly;
mod class;
mod class_field;
mod domain;
mod image;
mod method;
mod mono_type;
mod object;
mod string;
mod thread;
mod type_kind;
mod value;
mod vtable;
pub use array::MonoArray;
pub use assembly::MonoAssembly;
pub use class::MonoClass;
pub use class_field::MonoClassField;
pub use domain::MonoDomain;
pub use image::MonoImage;
pub use method::MonoMethod;
pub use mono_type::MonoType;
pub use object::MonoObject;
pub use string::MonoString;
pub use thread::MonoThread;
pub use type_kind::TypeKind;
pub use value::Value;
pub use vtable::MonoVTable;
use std::ffi::c_void;
pub type MonoFunc = unsafe extern "C" fn(data: *mut c_void, user_data: *mut c_void);
macro_rules! mono_handle {
($name:ident) => {
use std::{ffi::c_void, ptr::NonNull};
#[repr(transparent)]
#[derive(Clone, Copy, Debug)]
pub struct $name(NonNull<c_void>);
impl $name {
#[must_use]
pub fn as_ptr(self) -> *mut c_void {
self.0.as_ptr()
}
#[must_use]
pub fn from_ptr(ptr: *mut c_void) -> Option<Self> {
NonNull::new(ptr).map(Self)
}
#[must_use]
pub unsafe fn from_ptr_unchecked(ptr: *mut c_void) -> Self {
Self(unsafe { NonNull::new_unchecked(ptr) })
}
}
};
}
pub(crate) use mono_handle;