MatlabClass

Trait MatlabClass 

Source
pub trait MatlabClass<P>: Sized + Deref<Target = mxArray_tag> {
    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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§