API reference Dodo 0.1.4

std/web/app

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

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

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
application std/web/application app.dodo
console std/console app.dodo
hosted std/web/hosted app.dodo
hosting std/http/hosting app.dodo
io std/io app.dodo
native std/net/native app.dodo
net std/net app.dodo
reactor std/web/reactor app.dodo
testing std/web/testing app.dodo
web std/web app.dodo

WORKSPACE_BYTES

Constant · Source

pub const WORKSPACE_BYTES: usize = hosted.WORKSPACE_BYTES

BODY_BYTES

Constant · Source

pub const BODY_BYTES: usize = 4096

DEFAULT_CONNECTIONS

Constant · Source

pub const DEFAULT_CONNECTIONS: usize = 8

Limits

Struct · Source

pub struct Limits {
    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
}

Limits.defaults

Function · Source

pub fn defaults() -> Limits

Timeouts

Struct · Source

pub struct Timeouts {
    pub header_ms: u64
    pub body_ms: u64
    pub request_ms: u64
    pub write_ms: u64
    pub idle_ms: u64
}

Timeouts.defaults

Function · Source

pub fn defaults() -> Timeouts

Execution

Enum · Source

pub enum Execution {
    Serial, Concurrent
}

Config

Struct · Source

pub struct Config {
    pub limits: Limits
    pub timeouts: Timeouts
    pub execution: Execution
    pub backlog: u32
    // Total accepted connections, not simultaneous connections. Zero is unlimited.
    pub max_connections: usize
    pub requests_per_connection: usize
    pub events_per_turn: usize
}

Config.defaults

Function · Source

pub fn defaults() -> Config

Config.serial

Function · Source

pub fn serial(&self) -> hosted.Config

Config.concurrent

Function · Source

pub fn concurrent(&self) -> reactor.Config

Storage

Struct · Source

Borrowed storage is reusable after serving returns. Body capacities are per slot in concurrent mode; trailing bytes after equal division are unused.

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

Storage.new

Function · Source

pub fn new(workspace: &mut[u8], request: &mut[u8], response: &mut[u8]) -> Storage from(workspace, request, response)

Storage.concurrent

Function · Source

pub fn concurrent(workspace: &mut[u8], request: &mut[u8], response: &mut[u8], slots: &mut[reactor.Slot]) -> Storage from(workspace, request, response, slots)

Server

Struct · Source

Owns route metadata, named handler values, and grouped configuration. The default storage lives only for a serving call; no self-referential borrows. Serving consumes this object. Custom Storage is borrowed and can be reused.

pub struct Server<H> {
    pub application: application.Application<H>
    pub config: Config
}

Server.new

Function · Source

pub fn new(application: application.Application<H>) -> Server<H> from(application)

Server.request

Function · Source

pub fn request(&mut self, method: &[u8], target: &[u8]) -> testing.Response

Server.request_with

Function · Source

pub fn request_with(&mut self, input: &testing.Request) -> testing.Response

Server.serve

Function · Source

pub fn serve(self, address: &[u8]) -> hosted.Report!hosting.Error

Server.serve_until

Function · Source

pub fn serve_until<X>(self, address: &[u8], cancel: &X) -> hosted.Report!hosting.Error

Server.serve_in

Function · Source

pub fn serve_in(self, address: &[u8], storage: &mut Storage) -> hosted.Report!hosting.Error

Server.serve_serial_with

Function · Source

Explicit serial transport hook. Never silently downgrade a requested concurrent server to serial execution.

pub fn serve_serial_with<A, C, X>(self, address: &[u8], storage: &mut Storage,
    acceptor: &mut A, clock: &mut C, cancel: &X) -> hosted.Report!hosting.Error

Server.serve_concurrent_with

Function · Source

Concurrent transport hook; providers declare their extra staging bytes per slot. Storage remains caller-owned and reusable after return.

pub fn serve_concurrent_with<P, C, X>(self, address: &[u8], storage: &mut Storage,
    provider: &mut P, clock: &mut C, cancel: &X) -> hosted.Report!hosting.Error

Server.serve_with

Function · Source

pub fn serve_with<C, X>(self, address: &[u8], storage: &mut Storage, clock: &mut C, cancel: &X) -> hosted.Report!hosting.Error

Error

Struct · Source

One error boundary for fluent setup and hosted serving.

pub struct Error {
    pub registration: Option<application.RegistrationError>
    pub serving: Option<hosting.Error>
}

Error.format

Function · Source

pub fn format<F>(&self, output: &mut F) -> void!io.Error

Builder

Struct · Source

pub struct Builder<H, M> {
    pub config: Config
    // Private implementation fields omitted.
}

Builder.route

Function · Source

pub fn route<N>(self, method: &[u8], pattern: &[u8], handler: N) -> Builder<application.Handlers<H, N>, M> from(self, method, pattern, handler)

Builder.get

Function · Source

pub fn get<N>(self, pattern: &[u8], handler: N) -> Builder<application.Handlers<H, N>, M> from(self, pattern, handler)

Builder.post

Function · Source

pub fn post<N>(self, pattern: &[u8], handler: N) -> Builder<application.Handlers<H, N>, M> from(self, pattern, handler)

Builder.put

Function · Source

pub fn put<N>(self, pattern: &[u8], handler: N) -> Builder<application.Handlers<H, N>, M> from(self, pattern, handler)

Builder.patch

Function · Source

pub fn patch<N>(self, pattern: &[u8], handler: N) -> Builder<application.Handlers<H, N>, M> from(self, pattern, handler)

Builder.delete

Function · Source

pub fn delete<N>(self, pattern: &[u8], handler: N) -> Builder<application.Handlers<H, N>, M> from(self, pattern, handler)

Builder.head

Function · Source

pub fn head<N>(self, pattern: &[u8], handler: N) -> Builder<application.Handlers<H, N>, M> from(self, pattern, handler)

Builder.options

Function · Source

pub fn options<N>(self, pattern: &[u8], handler: N) -> Builder<application.Handlers<H, N>, M> from(self, pattern, handler)

Builder.middleware

Function · Source

pub fn middleware<N>(self, middleware: N) -> Builder<H, web.Chain<M, N>> from(self, middleware)

Builder.concurrent

Function · Source

pub fn concurrent(self) -> Builder<H, M> from(self)

Builder.max_connections

Function · Source

pub fn max_connections(self, count: usize) -> Builder<H, M> from(self)

Builder.build

Function · Source

pub fn build(self) -> Server<web.WithMiddleware<H, M>>!application.RegistrationError from(self)

Builder.run

Function · Source

Main-function convenience: printable startup failures and an exit code.

pub fn run(self, address: &[u8]) -> i32

Builder.run_with

Function · Source

Transport supplies serve(server, address) -> hosted.Report!E, where E is printable. Plain apps do not import or link a TLS backend.

pub fn run_with<T>(self, address: &[u8], transport: T) -> i32

Builder.serve

Function · Source

pub fn serve(self, address: &[u8]) -> hosted.Report!Error from(self)

Builder.serve_until

Function · Source

pub fn serve_until<X>(self, address: &[u8], cancel: &X) -> hosted.Report!Error from(self)

new

Function · Source

pub fn new() -> Builder<application.Empty, web.NoMiddleware> from(static)

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
?