Skip to main content

alux_http_text/
input.rs

1//! Names the input roles an endpoint reads, without extracting anything.
2
3use crate::TextHandlerImpl;
4use alux_http::HttpInputAlg;
5use core::marker::PhantomData;
6
7/// Identifies an HTTP input role in text output.
8pub struct TextInputRole<Role, Input>(PhantomData<fn(Role) -> Input>);
9
10/// Identifies path extraction in text descriptions.
11pub struct PathRole;
12/// Identifies query extraction in text descriptions.
13pub struct QueryRole;
14/// Identifies request-body extraction in text descriptions.
15pub struct BodyRole;
16/// Identifies form-encoded request-body extraction in text descriptions.
17pub struct FormRole;
18/// Identifies extraction from a body arriving as parts, in text descriptions.
19pub struct MultipartRole;
20/// Identifies extraction of the request body as it arrived, in text descriptions.
21pub struct RawBodyRole;
22/// Identifies header extraction in text descriptions.
23pub struct HeaderRole;
24/// Identifies cookie extraction in text descriptions.
25pub struct CookieRole;
26/// Identifies authentication extraction in text descriptions.
27pub struct AuthRole;
28/// Identifies request-context extraction in text descriptions.
29pub struct ContextRole;
30
31impl HttpInputAlg for TextHandlerImpl {
32    type Path<Input> = TextInputRole<PathRole, Input>;
33    type Query<Input> = TextInputRole<QueryRole, Input>;
34    type Body<Input> = TextInputRole<BodyRole, Input>;
35    type Form<Input> = TextInputRole<FormRole, Input>;
36    type Multipart<Input> = TextInputRole<MultipartRole, Input>;
37    type RawBody<Input> = TextInputRole<RawBodyRole, Input>;
38    type Header<Input> = TextInputRole<HeaderRole, Input>;
39    type Cookie<Input> = TextInputRole<CookieRole, Input>;
40    type Auth<Input> = TextInputRole<AuthRole, Input>;
41    type Context<Input> = TextInputRole<ContextRole, Input>;
42}