Skip to main content

Crate alux_http_poem

Crate alux_http_poem 

Source
Expand description

§alux-http-poem

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

use alux_http::HttpProgramExt;
use alux_http_poem::PoemHandlerImpl;

let api = PoemHandlerImpl::new(App::new());
let route = api.compile_http(api.status_api::<App>()).into_poem();

poem::Server::new(poem::listener::TcpListener::bind("0.0.0.0:3000")).run(route).await?;

Poem bodies, headers, errors, and endpoint erasure stay inside this crate. Compiling the same program with alux-http-text observes the identical ordered surface.

Interprets typed HTTP programs as executable Poem routes.

The interpretation chooses Poem’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§

PoemBodyInput
Marks a JSON value extracted from the request body by Poem.
PoemBytesOutput
Converts semantic results into Poem raw-byte responses.
PoemCarrying
Carries a converted body and a header’s value until Poem writes them.
PoemCookieInput
Marks a value read from the cookies a caller sent.
PoemEmptyOutput
Converts a handler that returns nothing into an answer with no body.
PoemEndpoint
Erases a native Poem endpoint for route composition.
PoemFileOutput
Converts semantic file results into downloadable Poem responses.
PoemFileResponse
Carries a file result and filename until Poem creates the response.
PoemFormInput
Marks a form-encoded value extracted from the request body by Poem.
PoemHandlerImpl
Interprets typed HTTP programs as executable Poem routes.
PoemHeaderInput
Marks a value read from the headers a caller sent.
PoemHeaderOutput
Answers with a header the handler stated, beside the body it stated.
PoemHtmlOutput
Converts semantic results into Poem HTML responses.
PoemJsonOutput
Converts semantic results into Poem JSON responses.
PoemMultipartInput
Marks an argument read from a body arriving as parts.
PoemOpen
Carries an open Poem server that is accepting requests.
PoemPart
One part Poem read.
PoemPartContent
What one part carries, as the chunks it arrives in.
PoemParts
The parts Poem read, as the sequence they arrive in.
PoemPathInput
Marks a value extracted from the request path by Poem.
PoemQueryInput
Marks a value extracted from the query string by Poem.
PoemRedirectOutput
Converts a semantic location into a Poem redirect.
PoemRequestInput
Marks a value extracted through Poem’s general request extractor.
PoemResultOutput
Answers with what a failure means when the handler failed, and with the body it states otherwise.
PoemResultResponse
Carries either a converted body or the meaning of a failure until Poem answers with it.
PoemRoute
Carries a composable collection of native Poem endpoints.
PoemRouteImpl
Interprets categorical route composition as native Poem routing.
PoemSelector
Carries route-selection meaning before it is interpreted by Poem.
PoemServer
Serves a Poem route at the address its setup names.
PoemStatusOutput
Answers with the status an endpoint declared, around the body it already states.
PoemStatusResponse
Carries a converted body until Poem gives it the declared status.
PoemStreamOutput
Converts a semantic stream of chunks into a Poem streamed body.
PoemTextOutput
Converts semantic results into Poem plain-text responses.

Functions§

poem_status
Interprets a portable status as the one Poem answers with.