pub trait HostWithStore<T>:
HasData
+ HostHttpListenerWithStore<T>
+ Send {
// Required methods
fn accept_http(
accessor: &Accessor<T, Self>,
listener: Resource<HttpListener>,
) -> impl Future<Output = Result<Option<HttpRequest>, WasmError>> + Send;
fn submit_exchange(
accessor: &Accessor<T, Self>,
exchange: WasmExchange,
) -> impl Future<Output = Result<SubmitOutcome, WasmError>> + Send;
}Required Methods§
Sourcefn accept_http(
accessor: &Accessor<T, Self>,
listener: Resource<HttpListener>,
) -> impl Future<Output = Result<Option<HttpRequest>, WasmError>> + Send
fn accept_http( accessor: &Accessor<T, Self>, listener: Resource<HttpListener>, ) -> impl Future<Output = Result<Option<HttpRequest>, WasmError>> + Send
Accept the next HTTP request, or none if cancelled. Async: the guest
awaits, yielding back to the host until a request arrives (or the run
is cancelled). The body is a stream-body-handle — the guest reads
incrementally via stream<u8>.read, removing the materialization cap.
Sourcefn submit_exchange(
accessor: &Accessor<T, Self>,
exchange: WasmExchange,
) -> impl Future<Output = Result<SubmitOutcome, WasmError>> + Send
fn submit_exchange( accessor: &Accessor<T, Self>, exchange: WasmExchange, ) -> impl Future<Output = Result<SubmitOutcome, WasmError>> + Send
Push an exchange into the pipeline. Returns once the pipeline accepts
the envelope (before full body drain). The guest MUST keep run alive
while a submitted body stream is still draining; the stream’s terminal
future resolves when the body finished.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl HostWithStore<SourceHostState> for HasSelf<SourceHostState>
Async host imports. The guest’s run (async) awaits these; each receives
&Accessor<SourceHostState, HasSelf<SourceHostState>> (shared access into
the store, NOT &mut self). We snapshot owned values (clones) out of a
with call, then .await OUTSIDE it — Accessor::with is sync and must
not be held across an await. Cancellation races every await against the
shared CancellationToken so stop() unblocks a parked import promptly.
impl HostWithStore<SourceHostState> for HasSelf<SourceHostState>
Async host imports. The guest’s run (async) awaits these; each receives
&Accessor<SourceHostState, HasSelf<SourceHostState>> (shared access into
the store, NOT &mut self). We snapshot owned values (clones) out of a
with call, then .await OUTSIDE it — Accessor::with is sync and must
not be held across an await. Cancellation races every await against the
shared CancellationToken so stop() unblocks a parked import promptly.