Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/web/reactor"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
bytes |
core/bytes |
reactor.dodo |
connection |
std/http/connection |
reactor.dodo |
hosted |
std/web/hosted |
reactor.dodo |
hosting |
std/http/hosting |
reactor.dodo |
http |
std/http |
reactor.dodo |
io |
std/io |
reactor.dodo |
mem |
core/mem |
reactor.dodo |
native |
std/net/native |
reactor.dodo |
net |
std/net |
reactor.dodo |
slice |
core/slice |
reactor.dodo |
web |
std/web |
reactor.dodo |
WORKSPACE_BYTES
Constant · Source
pub const WORKSPACE_BYTES: usize = hosted.WORKSPACE_BYTES
Config
Struct · Source
pub struct Config {
pub server: hosted.Config
pub requests_per_connection: usize
pub idle_timeout_ms: u64
pub events_per_turn: usize
}
Config.defaults
Function · Source
pub fn defaults() -> Config
Slot
Struct · Source
No buffer borrows survive a turn. Each slot owns one socket and opaque HTTP state; disjoint caller-owned byte ranges accompany it when it is resumed.
pub struct Slot {
// Private implementation fields omitted.
}
Slot.new
Function · Source
pub fn new() -> Slot
slots
Function · Source
A small ready-to-use slot array. Applications may instead supply any array or owned collection with 1..255 Slot.new() values and matching byte storage.
pub fn slots() -> [8]Slot
serve
Function · Source
pub fn serve<H>(address: &[u8], routes: &[web.Route], handler: &mut H, slots: &mut[Slot], workspace: &mut[u8],
request: &mut[u8], response: &mut[u8], config: Config) -> hosted.Report!hosting.Error
serve_with
Function · Source
Handlers run synchronously on this thread; waiting sockets do not block peers. Cancellation closes all owned sockets, including every error/return path.
pub fn serve_with<H, C, X>(address: &[u8], routes: &[web.Route], handler: &mut H, slots: &mut[Slot], workspace: &mut[u8],
request: &mut[u8], response: &mut[u8], config: Config, clock: &mut C, cancel: &X) -> hosted.Report!hosting.Error
serve_using
Function · Source
Providers declare staging_bytes and handshake_required. Provider.open(index, socket, staging) resumes a polling session; save retains its movable state and close releases it. Sessions supply polling I/O, handshake, flush, finish, prepare, writing, take_error and suspend methods. No session or byte-buffer borrow survives a reactor turn.
pub fn serve_using<P, H, C, X>(address: &[u8], routes: &[web.Route], handler: &mut H, slots: &mut[Slot], workspace: &mut[u8],
request: &mut[u8], response: &mut[u8], config: Config, provider: &mut P, clock: &mut C, cancel: &X) -> hosted.Report!hosting.Error
PlainProvider
Struct · Source
Plain HTTP selects no TLS implementation or extra storage.
pub struct PlainProvider {
}
PlainProvider.handshake_required
Function · Source
pub fn handshake_required(&self) -> bool
PlainProvider.staging_bytes
Function · Source
pub fn staging_bytes(&self) -> usize
PlainProvider.open
Function · Source
pub fn open(&mut self, index: usize, socket: &mut native.TcpConnection, staging: &mut[u8]) -> PlainStream!hosting.Error from(socket)
PlainProvider.save
Function · Source
pub fn save(&mut self, index: usize, state: bool)
PlainProvider.close
Function · Source
pub fn close(&mut self, index: usize)
PlainStream
Struct · Source
pub struct PlainStream {
// Private implementation fields omitted.
}
PlainStream.poll_read
Function · Source
pub fn poll_read(&mut self, data: &mut[u8]) -> io.Poll!io.Error
PlainStream.poll_write
Function · Source
pub fn poll_write(&mut self, data: &[u8]) -> io.Poll!io.Error
PlainStream.handshake
Function · Source
pub fn handshake(&mut self) -> bool!hosting.Error
PlainStream.flush
Function · Source
pub fn flush(&mut self) -> bool!hosting.Error
PlainStream.finish
Function · Source
pub fn finish(&mut self) -> bool!hosting.Error
PlainStream.prepare
Function · Source
pub fn prepare(&mut self) -> bool!hosting.Error
PlainStream.writing
Function · Source
pub fn writing(&self, http_writing: bool) -> bool
PlainStream.take_error
Function · Source
pub fn take_error(&mut self) -> Option<hosting.Error>
PlainStream.suspend
Function · Source
pub fn suspend(self) -> bool