Skip to main content

Crate alux_http_axum

Crate alux_http_axum 

Source
Expand description

§alux-http-axum

alux-http-axum interprets an alux-http program as executable axum routes. The interpreter chooses axum extractors for input roles, axum responses for output kinds, and Arc for the runtime handle of a semantic context.

use alux_http::HttpProgramExt;
use alux_http_axum::AxumHandlerImpl;

let api = AxumHandlerImpl::new(App::new());
let router = api.compile_http(api.status_api::<App>()).into_axum();

axum::serve(tokio::net::TcpListener::bind("0.0.0.0:3000").await?, router).await?;

Shared state reaches a handler as the semantic context from the program, not as axum state. This keeps framework types out of the specification and its domain operations.

axum uses /status/{id} for a parameter path. The same program compiled with alux-http-poem routes /status/:id and describes it identically.

Interprets typed HTTP programs as executable axum routes.

The interpretation chooses axum’s extractors for input roles, its responses for output kinds, and Arc for the runtime handle of a semantic context. Those choices stay inside this crate: the program compiled here is the same value any other interpreter folds.

Structs§

AxumBodyInput
Marks a JSON value extracted from the request body by axum.
AxumBytesOutput
Converts semantic results into axum raw-byte responses.
AxumCarrying
Carries a converted body and a header’s value until axum writes them.
AxumCookieInput
Marks a value read from the cookies a caller sent.
AxumEmptyOutput
Converts a handler that returns nothing into an answer with no body.
AxumEndpoint
Erases a native axum service for route composition.
AxumFileOutput
Converts semantic file results into downloadable axum responses.
AxumFileResponse
Carries a file result and filename until axum creates the response.
AxumFormInput
Marks a form-encoded value extracted from the request body by axum.
AxumHandlerImpl
Interprets typed HTTP programs as executable axum routes.
AxumHeaderInput
Marks a value read from the headers a caller sent.
AxumHeaderOutput
Answers with a header the handler stated, beside the body it stated.
AxumHtmlOutput
Converts semantic results into axum HTML responses.
AxumJsonOutput
Converts semantic results into axum JSON responses.
AxumMultipartInput
Marks an argument read from a body arriving as parts.
AxumPart
One part axum read.
AxumPartContent
What one part carries, as the chunks it arrives in.
AxumParts
The parts axum read, as the sequence they arrive in.
AxumPartsInput
Marks a value extracted from the request head by axum.
AxumPathInput
Marks a value extracted from the request path by axum.
AxumQueryInput
Marks a value extracted from the query string by axum.
AxumRawBodyInput
Marks the request body taken by axum as it arrived.
AxumRedirectOutput
Converts a semantic location into an axum redirect.
AxumResultOutput
Answers with what a failure means when the handler failed, and with the body it states otherwise.
AxumResultResponse
Carries either a converted body or the meaning of a failure until axum answers with it.
AxumRoute
Carries a composable collection of native axum services.
AxumRouteImpl
Interprets categorical route composition as native axum routing.
AxumSelector
Carries route-selection meaning before it is interpreted by axum.
AxumServer
Serves an axum route at the address its setup names.
AxumStatusOutput
Answers with the status an endpoint declared, around the body it already states.
AxumStatusResponse
Carries a converted body until axum gives it the declared status.
AxumStreamOutput
Converts a semantic stream of chunks into an axum streamed body.
AxumTextOutput
Converts semantic results into axum plain-text responses.

Functions§

axum_status
Interprets a portable status as the one axum answers with.