Skip to main content

Module context

Module context 

Source
Expand description

The IoContext typestate and the Command handler trait.

IoContext<S, O> is the server’s per-request work item, generic over its lifecycle state S and origin O. Transitions consume self by value, so the previous state becomes unusable — the borrow checker enforces the request lifecycle. Everything here is static dispatch (see the plan’s §12).

Structs§

IoContext
The server’s work item for one request (or one server event). Owns the reply header and — while Solicited — the parsed request; parameterized by the lifecycle state S and origin O.
Resources
Per-request access to the mutable connection and shared server state a handler needs. Borrowed for the duration of one dispatch on the connection’s single thread, so no locking is required for the per-connection half.

Enums§

Outcome
The result of serving one accepted request. Encodes the final-vs-interim distinction in the type system.

Traits§

Command
One command’s server-side behaviour: map its owned request to an Outcome, using the connection/server Resources. Dispatched by a concrete match (never as a trait object), so it uses native async fn and needs no boxed future.