Module convert

Module convert 

Source
Expand description

Conversion to and from matlab with associated errors

The rustmex family of crates define a set of wrapper types, to encapsulate an untyped MatlabPtr with some type information, after which it’s contents can be accessed safely. This module defines the error types and other conversion tooling.

Structs§

Cat1
At compile time one might already know along what dimension to lay out a vector. That dimension (also for higher dimensionality than rows/columns) can be selected via Cat1.
DataShapeMismatch
For a lot of types, the shape the data is not stored along with the data itself, so it has to be provided separately. There can thus be a mismatch between the number of elements in the data and the shape provided. In that case, the data to be converted into a Matlab type is converted, along with the cause of the error.
DynCat
In case one does not know ahead of time how a vector is to be layed out — the direction is dynamic — DynCat can be used. Note that DynCat is 0-based.
FromMatlabError
Error converting from matlab. Stores the unconverted data, allowing it to be reused, especially for owned data.

Enums§

DataShapeMismatchReason
The reason a conversion failed
FromMatlabErrorReason
Possible errors which can occur when converting an mxArray into a Rust type.
VecType
Most Vectors are either a column-, or a row vector. This enum can be used to configure that direction via FromVec.

Traits§

FromVec
Since a Matlab vector always has at least two dimensions, we need some extra information to determine what shape the converted matrix in Matlab will have, since it is not stored in a Rust vector. See also VecType.
VecLayout
Trait for types describing how an array of vectors should be layed out when passed to Matlab. Matlab arrays are, after all, multidimensional; the vector can lay among any of them.

Type Aliases§

ToMatlabResult
Convenience Result type for converting types to Matlab types; returning the unconverted original data if the conversion failed. See DataShapeMismatch.