Trait rustmex_core::MatlabClass
source · pub trait MatlabClass<P>: Deref<Target = mxArray> + Sized {
type Owned;
// Required methods
fn from_mx_array(mx: P) -> Result<Self, FromMatlabError<P>>;
fn into_inner(self) -> P;
fn inner(&self) -> &P;
fn duplicate(&self) -> Self::Owned;
}Expand description
Base Matlab class trait. Matlab classes, in Rustmex, are wrapper structures around a
bare MatlabPtr, giving them some type information.
Required Associated Types§
Required Methods§
sourcefn from_mx_array(mx: P) -> Result<Self, FromMatlabError<P>>
fn from_mx_array(mx: P) -> Result<Self, FromMatlabError<P>>
Try to build a matlab class from a MatlabPtr. If the type requirements of
the class match what the pointer is, then the class is constructed. Otherwise,
an error is returned; containing the reason of the failure and the original
pointer. The latter is especially useful with MxArrays; the owned
MatlabPtr type — otherwise it would be dropped.
sourcefn into_inner(self) -> P
fn into_inner(self) -> P
Deconstruct the MatlabClass back to a bare MatlabPtr.