wrpc_runtime_wasmtime

Trait ServeExt

source
pub trait ServeExt: Serve {
    // Provided methods
    fn serve_function<T>(
        &self,
        store: impl Fn() -> Store<T> + Send + 'static,
        instance_pre: InstancePre<T>,
        ty: ComponentFunc,
        instance_name: &str,
        name: &str,
    ) -> impl Future<Output = Result<impl Stream<Item = Result<(Self::Context, Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>)>> + Send + 'static>> + Send
       where T: WasiView + WrpcView + 'static { ... }
    fn serve_function_shared<T>(
        &self,
        store: Arc<Mutex<Store<T>>>,
        instance: Instance,
        guest_resources: impl Into<Arc<[ResourceType]>>,
        ty: ComponentFunc,
        instance_name: &str,
        name: &str,
    ) -> impl Future<Output = Result<impl Stream<Item = Result<(Self::Context, Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>)>> + Send + 'static>> + Send
       where T: WasiView + WrpcView + 'static { ... }
}

Provided Methods§

source

fn serve_function<T>( &self, store: impl Fn() -> Store<T> + Send + 'static, instance_pre: InstancePre<T>, ty: ComponentFunc, instance_name: &str, name: &str, ) -> impl Future<Output = Result<impl Stream<Item = Result<(Self::Context, Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>)>> + Send + 'static>> + Send
where T: WasiView + WrpcView + 'static,

Serve types::ComponentFunc from an InstancePre instantiating it on each call. This serving method does not support guest-exported resources.

source

fn serve_function_shared<T>( &self, store: Arc<Mutex<Store<T>>>, instance: Instance, guest_resources: impl Into<Arc<[ResourceType]>>, ty: ComponentFunc, instance_name: &str, name: &str, ) -> impl Future<Output = Result<impl Stream<Item = Result<(Self::Context, Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>)>> + Send + 'static>> + Send
where T: WasiView + WrpcView + 'static,

Like Self::serve_function, but with a shared store instance. This is required to allow for serving functions, which operate on guest-exported resources.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: Serve> ServeExt for T