Skip to main content

Crate matlas

Crate matlas 

Source
Expand description

Safe, lifetime-aware Rust bindings for MATLAB’s Matrix, MEX and MAT-file APIs.

The safe API has three ownership categories: OwnedArray is destroyed by Rust, ArrayRef is a read-only borrow, and WorkspaceValue is a MATLAB workspace pointer valid until the next MATLAB callback.

Modules§

api_coverage
Function-by-function coverage of the R2025a API-800 C headers.
error_handling
Error propagation guarantees and unavoidable native termination cases.
raw
Unsafe one-to-one escape hatches for published API-800 operations.

Macros§

error_id
Create an ErrorId from a string literal, validated at compile time.
mex_entrypoint
Export a MEX entrypoint for fixed inputs, or use dynamic for DynInputs.

Structs§

ArrayInfo
Owned metadata-only array header returned by a MAT-file info operation. It intentionally cannot become an ArrayRef because MATLAB stores non-dereferenceable sentinels in its data pointers.
ArrayMut
An exclusive array view. Child and data borrows are tied to each method call.
ArrayRef
A read-only view. It can neither be destroyed nor transferred to MATLAB.
Complex
Interleaved complex values shared with Rust numerical crates. A complex number in Cartesian form.
DynInputs
Read-only MEX inputs with a variable argument count. Use mex_entrypoint!(handler, dynamic) for a dynamic handler.
Error
An error that preserves the native operation and MATLAB error status.
ErrorId
A validated MATLAB exception identifier of at most 255 ASCII bytes.
FileStream
Restricted diagnostic view of a MAT-file’s underlying C stream.
Inputs
Exactly N read-only MEX inputs, checked before the handler runs.
MatError
An unmodified error code from matGetErrno (not an OS errno).
MatFile
Owned MATFile handle tied to the current MEX invocation.
Matlab
A generative proof of the current MATLAB invocation and thread.
MatlabErrorInfo
Identifier and message copied from a trapped MATLAB callback exception. This does not include the exception’s stack or nested causes.
ModuleLock
One counted lock on the current MEX module.
MxBuffer
A byte buffer allocated by MATLAB’s memory manager. It is initialized by mxCalloc and is always released with the matching mxFree.
Named
A MAT-file value paired with its variable name.
Outputs
MEX output slots that accept ownership of Rust-created arrays.
OwnedArray
A uniquely owned MATLAB array. The invariant brand prevents it from escaping the MEX invocation that created it. Drop calls mxDestroyArray exactly once.
PersistentArray
A MATLAB-persistent array handle that may be stored between MEX calls.
PlainArrayRef
A primitive MATLAB array whose MAT-file serialization does not invoke user-defined MATLAB code. Cell, struct, string, and object arrays are excluded.
SparseIndices
Validated compressed-column indices borrowed from a sparse array.
UninitNumeric
An allocated numeric array that cannot be read or transferred until filled.
VariableInfos
Sequential iterator over variable headers in a MAT-file.
Variables
Sequential iterator over complete variables in a MAT-file.
WorkspaceScope
A workspace access period. WorkspaceScope::call consumes it and the supplied workspace values before invoking MATLAB.
WorkspaceValue
A pointer returned by mexGetVariablePtr. It can be read until it is consumed by WorkspaceScope::call or dropped.

Enums§

CallInput
One MATLAB callback input, either an ordinary view or a consumed workspace pointer. Use into() to assemble a mixed argument list.
Class
MATLAB’s stable matrix class identifiers.
ErrorKind
Failures distinguished without guessing undocumented native error numbers.
MatVersion
All creation formats accepted by matOpen.
OpenMode
Access mode for a MAT-file.
Workspace
MATLAB’s three workspace namespaces.

Traits§

Numeric
A Rust element with exactly the layout used by an API-800 numeric array.
ResultExt
Attach an exception identifier or context to a Result without losing its cause.
SparseNumeric
A numeric element supported by MATLAB’s published sparse constructor.

Functions§

eps
Return MATLAB’s floating-point epsilon constant.
inf
Return MATLAB’s positive infinity constant.
is_finite
Test a floating-point value with MATLAB’s finite predicate.
is_inf
Test a floating-point value with MATLAB’s infinity predicate.
is_nan
Test a floating-point value with MATLAB’s NaN predicate.
nan
Return MATLAB’s quiet NaN constant.

Type Aliases§

Result
Result type used by the safe API.