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>,
        host_resources: impl Into<Arc<HashMap<Box<str>, HashMap<Box<str>, (ResourceType, 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 { ... }
    fn serve_function_shared<T>(
        &self,
        store: Arc<Mutex<Store<T>>>,
        instance: Instance,
        guest_resources: impl Into<Arc<[ResourceType]>>,
        host_resources: impl Into<Arc<HashMap<Box<str>, HashMap<Box<str>, (ResourceType, 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>, host_resources: impl Into<Arc<HashMap<Box<str>, HashMap<Box<str>, (ResourceType, 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,

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]>>, host_resources: impl Into<Arc<HashMap<Box<str>, HashMap<Box<str>, (ResourceType, 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: Serve> ServeExt for T