pub struct ExtensionSpec { /* private fields */ }Expand description
Builder for an extension Manifest, used from build.rs.
Start with ExtensionSpec::new, chain configuration calls, declare
functions with function, and hand the result
to Build::new. See the crate-level example.
Implementations§
Source§impl ExtensionSpec
impl ExtensionSpec
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Creates a spec for an extension with the given name at the current
ABI version. The name must be a valid ASCII identifier (validated at
Build::generate time).
Sourcepub fn wasm_module(self, wasm_module: impl Into<String>) -> Self
pub fn wasm_module(self, wasm_module: impl Into<String>) -> Self
Sets the WASM import module the host functions are linked under. Defaults to the extension name when not set.
Sourcepub fn prewarm<I, S>(self, modules: I) -> Self
pub fn prewarm<I, S>(self, modules: I) -> Self
Sets the Python modules to import eagerly during Wizer pre-initialization, replacing any previously configured list.
Sourcepub fn function<F>(self, name: impl Into<String>, configure: F) -> Self
pub fn function<F>(self, name: impl Into<String>, configure: F) -> Self
Declares a host function. The closure configures the function’s params, return type, and asyncness.
Sourcepub fn into_manifest(self) -> Manifest
pub fn into_manifest(self) -> Manifest
Consumes the spec, returning the built manifest.
Trait Implementations§
Source§impl Clone for ExtensionSpec
impl Clone for ExtensionSpec
Source§fn clone(&self) -> ExtensionSpec
fn clone(&self) -> ExtensionSpec
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ExtensionSpec
impl RefUnwindSafe for ExtensionSpec
impl Send for ExtensionSpec
impl Sync for ExtensionSpec
impl Unpin for ExtensionSpec
impl UnwindSafe for ExtensionSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more