pub struct FunctionExportImpl {
registry: Arc<HostFunctionRegistry>,
config: ExportConfig,
}
Expand description
Function export for WASM
Fields§
§registry:
Arc<HostFunctionRegistry>§config:
ExportConfig
Implementations§
Source§
impl
FunctionExportImpl
impl FunctionExportImpl
Source
pub fn
new(bridge:
Arc<HostBridge>) -> Self
pub fn new(bridge: Arc<HostBridge>) -> Self
Create a new function export manager
Source
pub fn
with_config(bridge:
Arc<HostBridge>, config:
ExportConfig) -> Self
pub fn with_config(bridge: Arc<HostBridge>, config: ExportConfig) -> Self
Create with custom configuration
Source
pub async fn
register_function( &self, name: &str, signature:
FunctionSignature, callback:
HostFunctionCallback, ) ->
Result<()>
pub async fn register_function( &self, name: &str, signature: FunctionSignature, callback: HostFunctionCallback, ) -> Result<()>
Register a host function for export to WASM
Source
pub async fn
register_functions( &self, signatures:
Vec<FunctionSignature>, callbacks:
Vec<HostFunctionCallback>, ) ->
Result<()>
pub async fn register_functions( &self, signatures: Vec<FunctionSignature>, callbacks: Vec<HostFunctionCallback>, ) -> Result<()>
Register multiple host functions
Source
pub async fn
export_to_linker<T>(&self, linker:
&mut Linker<T>) ->
Result<()>
where T:
Send
+ 'static,
pub async fn
export_to_linker<T>(&self, linker:
&mut Linker<T>) ->
Result<()>
where T:
Send
+ 'static,
Export all registered functions to a WASMtime linker
Source
fn
export_single_function<T>( &self, linker:
&mut Linker<T>, name:
&str, func: &RegisteredHostFunction, ) ->
Result<()>
where T:
Send
+ 'static,
fn
export_single_function<T>( &self, linker:
&mut Linker<T>, name:
&str, func: &RegisteredHostFunction, ) ->
Result<()>
where T:
Send
+ 'static,
Export a single function to the linker
Source
fn
wasmtime_signature_from_signature( &self, _sig: &FunctionSignature, ) ->
Result<FuncType>
fn wasmtime_signature_from_signature( &self, _sig: &FunctionSignature, ) -> Result<FuncType>
Convert our signature to WASMtime signature type
Source
pub async fn
get_function_names(&self) ->
Vec<String>
pub async fn get_function_names(&self) -> Vec<String>
Get all registered function names
Source
pub async fn
get_function_stats(&self, name: &str) ->
Option<FunctionStats>
pub async fn get_function_stats(&self, name: &str) -> Option<FunctionStats>
Get function statistics
Source
pub async fn
unregister_function(&self, name: &str) ->
Result<bool>
pub async fn unregister_function(&self, name: &str) -> Result<bool>
Unregister a function
Auto Trait Implementations§
impl Freeze for FunctionExportImpl
impl !RefUnwindSafe for FunctionExportImpl
impl Send for FunctionExportImpl
impl Sync for FunctionExportImpl
impl Unpin for FunctionExportImpl
impl UnsafeUnpin for FunctionExportImpl
impl !UnwindSafe for FunctionExportImpl
Blanket Implementations§
Source§
impl<T>
BorrowMut<T> for T
where T: ?Sized,
impl<T>
BorrowMut<T> for T
where 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
§
impl<T> Instrument for T
impl<T> Instrument for T
§
fn
instrument(self, span: Span) ->
Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§
fn
in_current_span(self) ->
Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§
impl<T>
IntoEither
for T
impl<T> IntoEither for T
Source§
fn
into_either(self, into_left:
bool) ->
Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a
Left
variant of
Either<Self, Self>
if into_left is
true. Converts
self into a
Right
variant of
Either<Self, Self>
otherwise.
Read more
Source§
fn
into_either_with<F>(self, into_left: F)
->
Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a
Left
variant of
Either<Self, Self>
if
into_left(&self)
returns true. Converts
self into a
Right
variant of
Either<Self, Self>
otherwise.
Read more
Source§
impl<T>
IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§
fn
into_request(self) ->
Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in
a tonic::Request