Skip to main content

NativeModuleFactory

Trait NativeModuleFactory 

Source
pub trait NativeModuleFactory: Debug + 'static {
    // Required methods
    fn package_id(&self) -> &'static str;
    fn instantiate(
        &self,
        context: NativeModuleFactoryContext<'_>,
    ) -> Result<NativeModuleInstance, RuntimeFailure>;

    // Provided methods
    fn package_version(&self) -> &'static str { ... }
    fn factory_identity(&self) -> String { ... }
}
Expand description

Adapter-specific factory for a statically linked native Rust Module.

Required Methods§

Source

fn package_id(&self) -> &'static str

Package identity selected by the Resolved App Plan.

Source

fn instantiate( &self, context: NativeModuleFactoryContext<'_>, ) -> Result<NativeModuleInstance, RuntimeFailure>

Creates a fresh Module Instance generation.

Provided Methods§

Source

fn package_version(&self) -> &'static str

Exact statically linked Cargo package version.

Source

fn factory_identity(&self) -> String

Immutable factory identity advertised by the exact Host Build Manifest.

Plugin-resolved Plans carry this value as their package revision. The default keeps ordinary statically linked factories unique by package and version while allowing a factory to override the identity when its build authority is more specific than a Cargo package version.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§