Skip to main content

ExportEntry

Enum ExportEntry 

Source
pub enum ExportEntry {
    Native {
        name: &'static str,
        signature: fn() -> Result<(Vec<Expr>, Expr), String>,
    },
    Margs {
        name: &'static str,
        signature: fn() -> (Vec<Expr>, Expr),
    },
    Wstp {
        name: &'static str,
    },
    Wxf {
        name: &'static str,
        signature: fn() -> Result<(Vec<Expr>, Expr), String>,
    },
}
Expand description

Inventory entry for one #[export]-marked function.

Replaces the legacy LibraryLinkFunction enum from wolfram-library-link. All three export-mode runtimes (wolfram-export-native, wolfram-export-wstp, wolfram-export-wxf) submit entries of this single shared type to one global inventory; exported_library_functions_association iterates that inventory regardless of mode.

Variants§

§

Native

Native MArgument-based export.

Fields

§name: &'static str

Exported symbol name (matches the #[no_mangle] extern "C" symbol).

§signature: fn() -> Result<(Vec<Expr>, Expr), String>

Closure returning (arg types, return type) as Wolfram Language Exprs.

See the implementation note on LibraryLinkFunction::Native::signature for why this is a fn pointer rather than a Box<dyn ...>.

§

Margs

Raw MArgument-based export (#[export(margs)]). Argument/return types are opaque to the macro by default (the user marshals &[MArgument]/MArgument by hand) — unlike Native, whose signature is inferred from FromArg/IntoArg impls, there’s nothing to infer here. signature is never absent, though: the macro always materializes one at expansion time — the user’s #[export(margs, args = ..., ret = ...)] annotation if given, or (with a compile-time warning) a default of the same fixed LinkObject/LinkObject placeholder Wstp uses.

Fields

§name: &'static str

Exported symbol name.

§signature: fn() -> (Vec<Expr>, Expr)

(arg types, return type) — user-declared, or the macro’s own LinkObject/LinkObject default.

§

Wstp

WSTP LinkObject-based export.

Fields

§name: &'static str

Exported symbol name.

§

Wxf

Typed-args WXF-based export (NEW). Wire shape is {ByteArray} -> ByteArray at the LibraryLink level; the byte arrays carry WXF-encoded payloads of the user-declared Rust types.

Fields

§name: &'static str

Exported symbol name.

§signature: fn() -> Result<(Vec<Expr>, Expr), String>

Closure returning (arg types, return type) as Wolfram Language Exprs — used for the manifest’s typed signature display, not for the WL-side LibraryFunctionLoad call (which is always {ByteArray} -> ByteArray).

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.