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/http/connection"
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 |
connection.dodo |
http |
std/http |
connection.dodo |
io |
std/io |
connection.dodo |
mem |
core/mem |
connection.dodo |
ErrorKind
Enum · Source
pub enum ErrorKind {
Protocol, Transport, Backpressure, InvalidState, TimedOut, Cancelled
}
Error
Struct · Source
pub struct Error {
pub kind: ErrorKind
pub protocol: http.Error
pub transport: io.Error
}
waiting
Function · Source
pub fn waiting() -> http.Event
State
Struct · Source
A connection driver owns only caller buffers and protocol state. Stream, execution, clock, cancellation, TLS and pooling are independent capabilities. Each poll performs at most one read/write OS/provider operation. Movable connection state for bounded executors. Buffer bytes remain owned by the caller and must accompany this state when it is resumed.
pub struct State {
// Private implementation fields omitted.
}
State.new
Function · Source
pub fn new(role: http.Role, limits: http.Limits) -> State
Connection
Struct · Source
pub struct Connection {
// Private implementation fields omitted.
}
Connection.new
Function · Source
pub fn new(role: http.Role, workspace: &mut[u8], input: &mut[u8], output: &mut[u8], limits: http.Limits) -> Connection!Error from(workspace, input, output)
Connection.resume
Function · Source
pub fn resume(state: State, workspace: &mut[u8], input: &mut[u8], output: &mut[u8]) -> Connection!Error from(workspace, input, output)
Connection.suspend
Function · Source
pub fn suspend(self) -> State
Connection.input_ended
Function · Source
pub fn input_ended(&self) -> bool
Connection.incoming_reusable
Function · Source
pub fn incoming_reusable(&self) -> bool
Connection.poison
Function · Source
pub fn poison(&mut self)
Connection.check
Function · Source
pub fn check(&mut self, now_ms: u64, deadline_ms: u64, cancelled: bool) -> void!Error
Connection.pending_output
Function · Source
pub fn pending_output(&self) -> usize
Connection.disable_reuse
Function · Source
pub fn disable_reuse(&mut self)
Connection.output_complete
Function · Source
pub fn output_complete(&self) -> bool
Connection.reusable
Function · Source
pub fn reusable(&self) -> bool
Connection.request
Function · Source
pub fn request(&mut self, request: &http.Request) -> void!Error
Connection.response
Function · Source
pub fn response(&mut self, response: &http.Response) -> void!Error
Connection.informational
Function · Source
Informational heads do not finish or replace the final response sender. Flush each head before queuing another. 101 is an explicit upgrade.
pub fn informational(&mut self, response: &http.Response) -> void!Error
Connection.send_body
Function · Source
Accepted body bytes have been copied to output and must not be replayed. Backpressure returns before touching source or sender state.
pub fn send_body(&mut self, source: &[u8]) -> usize!Error
Connection.append_body
Function · Source
Coalesce a body fragment with an entirely unsent head/body. The ordinary send_body contract still requires an empty output queue. Leave room for chunk framing before mutating sender state; callers can flush and retry.
pub fn append_body(&mut self, source: &[u8]) -> usize!Error
Connection.finish_body
Function · Source
pub fn finish_body(&mut self, trailers: &[http.Header]) -> void!Error
Connection.poll_body
Function · Source
One write, no retained source borrow and no staging copy. Chunked framing returns Backpressure so callers can fall back to send_body/poll_flush.
pub fn poll_body<S>(&mut self, stream: &mut S, source: &[u8]) -> io.Poll!Error
Connection.poll_flush
Function · Source
pub fn poll_flush<S>(&mut self, stream: &mut S) -> io.Poll!Error
Connection.poll_event
Function · Source
Body must be explicitly consumed before advancing. This also prevents pipeline read-ahead from overwriting data while a sink is backpressured.
pub fn poll_event<S>(&mut self, stream: &mut S) -> http.Event!Error
Connection.body
Function · Source
pub fn body(&self) -> &[u8]
Connection.consume_body
Function · Source
pub fn consume_body(&mut self, count: usize) -> void!Error
Connection.method
Function · Source
pub fn method(&self) -> &[u8]
Connection.target
Function · Source
pub fn target(&self) -> &[u8]
Connection.status
Function · Source
pub fn status(&self) -> u16
Connection.field
Function · Source
pub fn field(&self, offset: usize, length: usize) -> &[u8]!http.Error from(self)
Connection.unread
Function · Source
Upgraded bytes already read from the stream belong to the new protocol.
pub fn unread(&self) -> &[u8]
Connection.next_message
Function · Source
pub fn next_message(&mut self) -> void!Error