Skip to main content

Crate trillium_client

Crate trillium_client 

Source
Expand description

trillium client is a http client that uses the same conn approach as trillium but which can be used independently for any http client application.

§Connector

trillium_client::Client is built with a Connector. Each runtime crate (trillium_smol, trillium_tokio, trillium_async_std) offers a Connector implementation, which can optionally be combined with a tls crate such as trillium_rustls or trillium_native_tls.

See the documentation for Client and Conn for further usage examples.

Re-exports§

pub use websocket::WebSocketUpgradeError;websockets
pub use trillium_websockets::async_tungstenite;websockets
pub use trillium_websockets::tungstenite;websockets

Modules§

websocketwebsockets
Support for client-side WebSockets

Macros§

jsonsonic-rs
Construct a sonic_rs::Value from a JSON literal.

Structs§

ArcedConnector
An Arced and type-erased Connector
ArcedQuicClientConfig
An arc-wrapped, type-erased QUIC client config (endpoint factory).
Body
The trillium representation of a http body. This can contain either &'static [u8] content, Vec<u8> content, or a boxed AsyncRead/BodySource type.
Client
A HTTP Client supporting HTTP/1.x and, when configured with a quic implementation, HTTP/3. See Client::new and Client::new_with_quic for construction information.
Conn
a client connection, representing both an outbound http request and a http response
HeaderName
The name of a http header. This can be either a KnownHeaderName or a string representation of an unknown header.
HeaderValue
A HeaderValue represents the right hand side of a single name: value pair.
HeaderValues
A header value is a collection of one or more HeaderValue. It has been optimized for the “one HeaderValue” case, but can accomodate more than one value.
Headers
Trillium’s header map type
ResponseBody
A response body received from a server
UnexpectedStatusError
An unexpected http status code was received. Transform this back into the conn with From::from/Into::into.
Url
A parsed URL record.
Valuesonic-rs
Represents any valid JSON value.
WebSocketConfigwebsockets
The configuration for WebSocket connection.
WebSocketConnwebsockets
A struct that represents an specific websocket connection.

Enums§

ClientSerdeErrorserde_json or sonic-rs
A wrapper error for trillium_http::Error or, depending on json serializer feature, either sonic_rs::Error or serde_json::Error. Only available when either the sonic-rs or serde_json cargo features are enabled.
Error
Concrete errors that occur within trillium’s HTTP implementation
KnownHeaderName
A short nonehaustive enum of headers that trillium can represent as a u8. Use a KnownHeaderName variant instead of a &’static str anywhere possible, as it allows trillium to skip parsing the header entirely.
Method
HTTP request methods.
Status
HTTP response status codes.
Version
The version of the HTTP protocol in use.

Constants§

USER_AGENT
default http user-agent header

Traits§

Connector
Interface for runtime and tls adapters for the trillium client
IntoUrl
attempt to construct a url, with base if present
QuicClientConfig
Factory for creating client-side QUIC endpoints.

Functions§

client
constructs a new Client – alias for Client::new

Type Aliases§

Result
this crate’s result type