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§

source

type Owned

The owned variant of this matlab class.

Required Methods§

source

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.

source

fn into_inner(self) -> P

Deconstruct the MatlabClass back to a bare MatlabPtr.

source

fn inner(&self) -> &P

Get a reference to the inner MatlabPtr. However, note that for &mxArray and &mut mxArray, the returned references will be of type &&mxArray and &&mut mxArray.

source

fn duplicate(&self) -> Self::Owned

Make a deep clone of the inner MatlabPtr, and construct an Owned MatlabClass from it.

Implementors§