pub struct MxArray(/* private fields */);Expand description
The owned variant of an mxArray. Some of Matlab’s mex functions specify that the caller is responsible for deallocating the object when it is done with it, unless the object in question is returned to Matlab. This cannot be expressed with just (mutable) references, so this type implements the owned type.
It is basically a wrapper around a mutable reference to an mxArray, but it implements
the drop trait, so when it is dropped it calls mxDestroyArray. It implements
Deref and DerefMut, so it can also be used where-ever a (mutable) reference to
an mxArray is expected.
Implementations§
Source§impl MxArray
impl MxArray
Sourcepub unsafe fn assume_responsibility(mx: &'static mut mxArray_tag) -> MxArray
pub unsafe fn assume_responsibility(mx: &'static mut mxArray_tag) -> MxArray
Create an MxArray by assuming responsibility for freeing an mxArray. Unless you have allocated an mxArray yourself, you do not need this.
Sourcepub unsafe fn assume_responsibility_ptr(mx: *mut mxArray_tag) -> MxArray
pub unsafe fn assume_responsibility_ptr(mx: *mut mxArray_tag) -> MxArray
Sourcepub unsafe fn transfer_responsibility(o: MxArray) -> &'static mut mxArray_tag
pub unsafe fn transfer_responsibility(o: MxArray) -> &'static mut mxArray_tag
Transfer responsibility for deallocating this mxArray back to Matlab. Unless you are manually calling raw matlab functions, you do not need this.
Sourcepub unsafe fn transfer_responsibility_ptr(o: MxArray) -> *mut mxArray_tag
pub unsafe fn transfer_responsibility_ptr(o: MxArray) -> *mut mxArray_tag
Methods from Deref<Target = mxArray_tag>§
Sourcepub fn duplicate(&self) -> MxArray
pub fn duplicate(&self) -> MxArray
Create a deep copy of the array, and return as an owned type. However,
consider using MatlabClass::duplicate instead if you are already working
with MatlabClasses.
Sourcepub fn dimensions(&self) -> &[usize]
pub fn dimensions(&self) -> &[usize]
Return the sizes of the constituent dimensions of the mxArray
Sourcepub fn raw_class_id(&self) -> u32
pub fn raw_class_id(&self) -> u32
Return the raw class ID; the number Matlab returns.
Sourcepub fn class_id(&self) -> Result<ClassID, u32>
pub fn class_id(&self) -> Result<ClassID, u32>
Return Ok(ClassID) for mxArrays which map to a built-in class (such as
numeric arrays, structure arrays, and cell arrays (see ClassID);
otherwise it returns the raw class ID in the Err variant. These other
values of the raw class ID are used in modern versions of Matlab for custom
classes, defined via e..g classdef.
Sourcepub fn is_complex(&self) -> bool
pub fn is_complex(&self) -> bool
Check whether the backing array is complex. Since the only arrays which can be complex are numeric arrays, this also implies that.
pub fn complexity(&self) -> Complexity
Trait Implementations§
Source§impl AsRef<mxArray_tag> for MxArray
impl AsRef<mxArray_tag> for MxArray
Source§fn as_ref(&self) -> &mxArray_tag
fn as_ref(&self) -> &mxArray_tag
Source§impl Borrow<mxArray_tag> for MxArray
impl Borrow<mxArray_tag> for MxArray
Source§fn borrow(&self) -> &mxArray_tag
fn borrow(&self) -> &mxArray_tag
Source§impl MatlabPtr for MxArray
impl MatlabPtr for MxArray
Source§fn is_a<W>(self) -> Result<W, FromMatlabError<Self>>where
W: MatlabClass<Self>,
Self: Sized,
fn is_a<W>(self) -> Result<W, FromMatlabError<Self>>where
W: MatlabClass<Self>,
Self: Sized,
MatlabPtr is an untyped pointer; it does not know what the type of the
data it holds is. However, Rustmex provides types which represent that
information. If the MatlabPtr holds one of those data types, “upcast” the
pointer to that type and return it.