Crate rustmex

Source
Expand description

Rustmex: A library providing convenient Rust bindings to Matlab’s MEX C api.

Rustmex makes writing MEX functions in Rust a bit easier. It convert Matlab types, and the arguments it provides to mexFunction into more Rusty types, which can then be used to interface with other Rust code easily.

For installation instructions, see the backend module.

Re-exports§

pub use message::MexMessage;
pub use message::Error;
pub use message::Missing;

Modules§

alloc
Allocation related functionality
backend
Backends and Installation
cell
Cell arrays
char
Character arrays
convert
Convert directly to and from matlab pointers
function
Functions and function handles for calling back to Matlab
index
Array indexing functionality
message
Create and send Matlab warning and error messages
numeric
Numeric data classes
objects
Matlab object arrays/custom classes
prelude
As is convention in Rust, Rustmex defines a prelude to easily import often used functionality.
structs
Structures and structure arrays
workspace
Workspace related functions

Macros§

assert
Check some boolean condition; if it is not met, return an Err(Error) with the given id and message. Can be used within functions which return a rustmex::Result.
error
Unconditionally return a rustmex::Result with the error variant, set with an id and a message. Useful when the error condition has already been checked in some other way.
error_on
Check some boolean condition, if it is met, return an Err(Error) with the given id and message. Can be used within functions which return a rustmex::Result.
trigger_error
Trigger a Matlab error

Structs§

Complex
A complex number in Cartesian form.
FromMatlabError
Error converting from matlab. Stores the unconverted data, allowing it to be reused, especially for owned data.
MxArray
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.

Traits§

MatlabClass
Base Matlab class trait. Matlab classes, in Rustmex, are wrapper structures around a bare MatlabPtr, giving them some type information.
MutMatlabClass
Denotes whether the Matlab class is mutable.
NewEmpty
Some, but not all types, can be created in an empty state; whether they can is denoted by this trait.
OwnedMatlabClass
Denotes whether a Matlab class owns its data.
TakeData
Only some Matlab classes, i.e the numeric classes, have data that can be meaningfully taken out of the backing MutMatlabPtr.

Functions§

warning
Generate an ad-hoc warning from an id and a message

Type Aliases§

Lhs
The “left hand side” of a call to a mex function. In this slice, the return values should be placed.
Result
Convenience type for returning a Error containing a MexMessage in the error path.
Rhs
The “Right hand side” of a call to a mex function. These are the arguments provided to it in matlab.
mxArray
The main matlab opaque array type, returned and accepted as argument by various mex functions.

Attribute Macros§

entrypoint
Re-export the macro to annotate the entry point.