Struct wasmcloud_runtime::component::Component
source · pub struct Component<H>where
H: Handler,{ /* private fields */ }
Implementations§
source§impl<H> Component<H>where
H: Handler,
impl<H> Component<H>where
H: Handler,
sourcepub fn set_max_execution_time(
&mut self,
max_execution_time: Duration,
) -> &mut Self
pub fn set_max_execution_time( &mut self, max_execution_time: Duration, ) -> &mut Self
Sets maximum execution time for functionality exported by this component. Values below 1 second will be interpreted as 1 second.
sourcepub async fn read(rt: &Runtime, wasm: impl AsyncRead + Unpin) -> Result<Self>
pub async fn read(rt: &Runtime, wasm: impl AsyncRead + Unpin) -> Result<Self>
Reads the WebAssembly binary asynchronously and calls Component::new.
§Errors
Fails if either reading wasm
fails or Self::new fails
sourcepub fn read_sync(rt: &Runtime, wasm: impl Read) -> Result<Self>
pub fn read_sync(rt: &Runtime, wasm: impl Read) -> Result<Self>
Reads the WebAssembly binary synchronously and calls Component::new.
§Errors
Fails if either reading wasm
fails or Self::new fails
sourcepub async fn serve_wrpc<S>(
&self,
srv: &S,
handler: H,
events: Sender<WrpcServeEvent<S::Context>>,
) -> Result<Vec<InvocationStream>>where
S: Serve,
pub async fn serve_wrpc<S>(
&self,
srv: &S,
handler: H,
events: Sender<WrpcServeEvent<S::Context>>,
) -> Result<Vec<InvocationStream>>where
S: Serve,
Serve all exports of this Component using supplied wrpc_transport::Serve
The returned Vec contains an InvocationStream per each function exported by the component.
A WrpcServeEvent
containing the incoming wrpc_transport::Serve::Context
will be sent
on completion of each invocation.
The supplied Handler
will be used to satisfy imports.
Trait Implementations§
Auto Trait Implementations§
impl<H> Freeze for Component<H>
impl<H> !RefUnwindSafe for Component<H>
impl<H> Send for Component<H>
impl<H> Sync for Component<H>
impl<H> Unpin for Component<H>
impl<H> !UnwindSafe for Component<H>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self
file descriptor.source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self
file descriptor. Read moresource§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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 moresource§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