API reference Dodo 0.1.4

std/web/hosted

Public declarations, types, methods, and source contracts for std/web/hosted.

On this page

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/hosted"

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
allocation std/thread/native hosted.dodo
bytes core/bytes hosted.dodo
connection std/http/connection hosted.dodo
hosting std/http/hosting hosted.dodo
http std/http hosted.dodo
layout alloc/layout hosted.dodo
mem core/mem hosted.dodo
native std/net/native hosted.dodo
net std/net hosted.dodo
ptr core/ptr hosted.dodo
slice core/slice hosted.dodo
web std/web hosted.dodo

PATH_BYTES

Constant · Source

Fixed protocol, path, query and header storage; body buffers are separate.

pub const PATH_BYTES: usize = 2048

QUERY_BYTES

Constant · Source

pub const QUERY_BYTES: usize = 2048

REQUEST_HEADER_BYTES

Constant · Source

pub const REQUEST_HEADER_BYTES: usize = 16384

RESPONSE_HEADER_BYTES

Constant · Source

pub const RESPONSE_HEADER_BYTES: usize = 4096

RESPONSE_HEADER_FIELDS

Constant · Source

pub const RESPONSE_HEADER_FIELDS: usize = 32

WORKSPACE_BYTES

Constant · Source

pub const WORKSPACE_BYTES: usize = 61440

RouteIndex

Struct · Source

Use the runner’s inline buffer when it fits; otherwise own one allocation for the serving lifetime. The owner itself stays small and movable.

pub struct RouteIndex {
    // Private implementation fields omitted.
}

RouteIndex.new

Function · Source

pub fn new(routes: usize, small: &mut[usize]) -> RouteIndex!hosting.Error from(small)

RouteIndex.storage

Function · Source

pub fn storage(&mut self) -> &mut[usize]

Config

Struct · Source

pub struct Config {
    pub backlog: u32
    pub header_bytes: usize
    pub header_fields: usize
    pub body_bytes: usize
    pub response_bytes: usize
    pub path_bytes: usize
    pub query_bytes: usize
    pub query_fields: usize
    pub response_header_bytes: usize
    pub response_header_fields: usize
    pub header_timeout_ms: u64
    pub body_timeout_ms: u64
    pub request_timeout_ms: u64
    pub write_timeout_ms: u64
    // Zero means serve until cancelled. One request per accepted connection.
    pub max_connections: usize
}

Config.defaults

Function · Source

pub fn defaults() -> Config

Config.valid

Function · Source

pub fn valid(&self) -> bool

Config.limits

Function · Source

pub fn limits(&self, capacity: usize) -> http.Limits

Report

Struct · Source

pub struct Report {
    pub accepted: usize
    pub completed: usize
    pub rejected: usize
    pub failed: usize
    pub cancelled: bool
    pub last_error: Option<hosting.Error>
}

Text

Struct · Source

pub struct Text {
    // Private implementation fields omitted.
}

Text.new

Function · Source

pub fn new(body: &[u8]) -> Text from(body)

Text.handle

Function · Source

pub fn handle(&mut self, request: &mut web.Request, response: &mut web.Response) -> void!web.Failure

status

Function · Source

pub fn status(reason: &hosting.Error) -> u16

error_response

Function · Source

Fresh serialization is intentional: parser errors permanently poison the connection driver. No output from a failed serializer is ever transmitted.

pub fn error_response<S, C, X>(stream: &mut S, code: u16, output: &mut[u8], clock: &mut C, cancel: &X, until: u64) -> void!hosting.Error

request_error

Function · Source

pub fn request_error(reason: web.Failure) -> hosting.Error

response_head

Function · Source

pub fn response_head(driver: &mut connection.Connection, response: &web.Response, connection_value: &[u8]) -> void!hosting.Error

bodyless

Function · Source

pub fn bodyless(method: &[u8], code: u16) -> bool

Target

Struct · Source

pub struct Target {
    pub path: usize
    pub validated: web.Path
    pub query: usize
}

decode_target

Function · Source

pub fn decode_target(target: &[u8], path_buffer: &mut[u8], query_buffer: &mut[u8], config: &Config) -> Target!hosting.Error from(path_buffer)

serve_connection

Function · Source

An error response gets its own bounded write interval, even if request input timed out. Cancellation skips that write and closes immediately.

pub fn serve_connection<S, H, C, X>(stream: &mut S, router: &web.Router, handler: &mut H, workspace: &mut[u8],
request_body: &mut[u8], response_body: &mut[u8], config: &Config, request_id: u64,
clock: &mut C, cancel: &X) -> bool!hosting.Error

PlainAcceptor

Struct · Source

pub struct PlainAcceptor {

}

PlainAcceptor.serve

Function · Source

pub fn serve<H, C, X>(&mut self, socket: &mut native.TcpConnection, router: &web.Router, handler: &mut H,
    workspace: &mut[u8], request_body: &mut[u8], response_body: &mut[u8], config: &Config,
    request_id: u64, clock: &mut C, cancel: &X) -> bool!hosting.Error

serve

Function · Source

pub fn serve<H>(address: &[u8], routes: &[web.Route], handler: &mut H, workspace: &mut[u8], request_body: &mut[u8],
response_body: &mut[u8], config: Config) -> Report!hosting.Error

serve_with

Function · Source

Bounded serial execution: one socket, one request, no task/thread/pool per peer. Cooperative cancellation ends acceptance and aborts the current connection. No callback or socket ownership survives this function, including error exits.

pub fn serve_with<H, P, C, X>(address: &[u8], routes: &[web.Route], handler: &mut H, workspace: &mut[u8],
request_body: &mut[u8], response_body: &mut[u8], config: Config, acceptor: &mut P,
clock: &mut C, cancel: &X) -> Report!hosting.Error

Type to search all documentation.

Keyboard shortcuts

Search documentation
Ctrl K or /
Move through results
↑ ↓
Open selected result
Enter
Close a dialog
Esc
Show these shortcuts
?