pub struct Operation<Handler, Inputs = (), Args = (), Transform = ()> { /* private fields */ }Expand description
Carries a typed operation declaration as first-order data.
Implementations§
Source§impl<Handler, Inputs, Args, Transform> Operation<Handler, Inputs, Args, Transform>
impl<Handler, Inputs, Args, Transform> Operation<Handler, Inputs, Args, Transform>
Sourcepub fn declare<Method>(
self,
path: &str,
) -> Endpoint<Method, Handler, Inputs, Args, Transform>
pub fn declare<Method>( self, path: &str, ) -> Endpoint<Method, Handler, Inputs, Args, Transform>
Declares this operation at one path under one method selector, with no program around it.
A program that states many endpoints composes their routes rather than their types, so it needs each endpoint on its own. The named declarations below select one method each; this states the same thing for a method held as a type parameter.
Source§impl<Handler, Inputs, Args, Transform> Operation<Handler, Inputs, Args, Transform>
impl<Handler, Inputs, Args, Transform> Operation<Handler, Inputs, Args, Transform>
Sourcepub fn with<Input>(
self,
) -> WithInput<Handler, Inputs, Args, Transform, Direct<Input>, Input>
pub fn with<Input>( self, ) -> WithInput<Handler, Inputs, Args, Transform, Direct<Input>, Input>
Records an argument supplied directly in the interpreter’s input product.
Sourcepub fn path<Input>(
self,
) -> WithInput<Handler, Inputs, Args, Transform, Path<Input>, Input>
pub fn path<Input>( self, ) -> WithInput<Handler, Inputs, Args, Transform, Path<Input>, Input>
Records a path extractor whose value becomes the next handler argument.
Sourcepub fn query<Input>(
self,
) -> WithInput<Handler, Inputs, Args, Transform, Query<Input>, Input>where
Input: NamedValuesAlg,
pub fn query<Input>(
self,
) -> WithInput<Handler, Inputs, Args, Transform, Query<Input>, Input>where
Input: NamedValuesAlg,
Records a query extractor whose value becomes the next handler argument.
Sourcepub fn body<Input>(
self,
) -> WithInput<Handler, Inputs, Args, Transform, Body<Input>, Input>
pub fn body<Input>( self, ) -> WithInput<Handler, Inputs, Args, Transform, Body<Input>, Input>
Records a request-body extractor whose value becomes the next handler argument.
Sourcepub fn form<Input>(
self,
) -> WithInput<Handler, Inputs, Args, Transform, Form<Input>, Input>
pub fn form<Input>( self, ) -> WithInput<Handler, Inputs, Args, Transform, Form<Input>, Input>
Records a form-encoded request-body extractor whose value becomes the next handler argument.
Sourcepub fn raw_body<Input>(
self,
) -> WithInput<Handler, Inputs, Args, Transform, RawBody<Input>, Input>
pub fn raw_body<Input>( self, ) -> WithInput<Handler, Inputs, Args, Transform, RawBody<Input>, Input>
Records the request body as it arrived, becoming the next handler argument.
Sourcepub fn in_header<Input>(
self,
) -> WithInput<Handler, Inputs, Args, Transform, Header<Input>, Input>where
Input: NamedValuesAlg,
pub fn in_header<Input>(
self,
) -> WithInput<Handler, Inputs, Args, Transform, Header<Input>, Input>where
Input: NamedValuesAlg,
Records an incoming header extractor whose value becomes the next handler argument.
Records a cookie extractor whose value becomes the next handler argument.
Sourcepub fn multipart<Input>(
self,
) -> WithInput<Handler, Inputs, Args, Transform, Multipart<Input>, Input>
pub fn multipart<Input>( self, ) -> WithInput<Handler, Inputs, Args, Transform, Multipart<Input>, Input>
Records a body arriving as parts, read into the next handler argument.
Sourcepub fn auth<Input>(
self,
) -> WithInput<Handler, Inputs, Args, Transform, Auth<Input>, Input>where
Input: NamedValuesAlg,
pub fn auth<Input>(
self,
) -> WithInput<Handler, Inputs, Args, Transform, Auth<Input>, Input>where
Input: NamedValuesAlg,
Records an authentication extractor whose value becomes the next handler argument.
Sourcepub fn context<Input>(
self,
) -> WithInput<Handler, Inputs, Args, Transform, Context<Input>, Input>
pub fn context<Input>( self, ) -> WithInput<Handler, Inputs, Args, Transform, Context<Input>, Input>
Records an endpoint-context extractor whose value becomes the next handler argument.
Sourcepub fn out<Kind>(
self,
) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<Kind>>::Closed>where
Transform: CloseAlg<Kind>,
pub fn out<Kind>(
self,
) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<Kind>>::Closed>where
Transform: CloseAlg<Kind>,
Closes the declaration with the output kind Kind, inside every wrapper already stated.
The kind is interpreted only after the handler result type is known at the compilation boundary, so a downstream kind closes a declaration exactly as a built-in one does.
Sourcepub fn status<const CODE: u16>(
self,
) -> Operation<Handler, Inputs, Args, OpenWith<Transform, StatusOut<(), CODE>>>where
Transform: OpenAlg,
pub fn status<const CODE: u16>(
self,
) -> Operation<Handler, Inputs, Args, OpenWith<Transform, StatusOut<(), CODE>>>where
Transform: OpenAlg,
Answers with CODE, around what the rest of the declaration states.
Sourcepub fn out_header<Name>(
self,
) -> Operation<Handler, Inputs, Args, OpenWith<Transform, HeaderOut<(), Name>>>where
Transform: OpenAlg,
pub fn out_header<Name>(
self,
) -> Operation<Handler, Inputs, Args, OpenWith<Transform, HeaderOut<(), Name>>>where
Transform: OpenAlg,
Answers with the handler’s header value, around what the rest of the declaration states.
The handler answers with the value and then with what the rest states: (value, rest).
Sourcepub fn out_headers<Headers>(
self,
) -> Operation<Handler, Inputs, Args, OpenWith<Transform, HeadersOut<(), Headers>>>where
Transform: OpenAlg,
Headers: NamedValuesAlg,
pub fn out_headers<Headers>(
self,
) -> Operation<Handler, Inputs, Args, OpenWith<Transform, HeadersOut<(), Headers>>>where
Transform: OpenAlg,
Headers: NamedValuesAlg,
Answers with the headers the handler’s named product states, around what the rest states.
The output twin of Operation::in_header: each member of Headers is one header, named by
its member name, and the handler answers with (headers, rest).
Source§impl<Handler, Inputs, Args, Transform> Operation<Handler, Inputs, Args, Transform>
impl<Handler, Inputs, Args, Transform> Operation<Handler, Inputs, Args, Transform>
Sourcepub fn json(
self,
) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<JsonOut>>::Closed>
pub fn json( self, ) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<JsonOut>>::Closed>
Closes the declaration with JSON output meaning.
Sourcepub fn file(
self,
) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<FileOut>>::Closed>
pub fn file( self, ) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<FileOut>>::Closed>
Closes the declaration with streamed-file output meaning.
Sourcepub fn text(
self,
) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<TextOut>>::Closed>
pub fn text( self, ) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<TextOut>>::Closed>
Closes the declaration with plain-text output meaning.
Sourcepub fn html(
self,
) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<HtmlOut>>::Closed>
pub fn html( self, ) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<HtmlOut>>::Closed>
Closes the declaration with HTML output meaning.
Sourcepub fn bytes(
self,
) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<BytesOut>>::Closed>
pub fn bytes( self, ) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<BytesOut>>::Closed>
Closes the declaration with raw-byte output meaning.
Sourcepub fn empty(
self,
) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<EmptyOut>>::Closed>
pub fn empty( self, ) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<EmptyOut>>::Closed>
Closes the declaration with empty output meaning.
Sourcepub fn redirect(
self,
) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<RedirectOut>>::Closed>where
Transform: CloseAlg<RedirectOut>,
pub fn redirect(
self,
) -> Operation<Handler, Inputs, Args, <Transform as CloseAlg<RedirectOut>>::Closed>where
Transform: CloseAlg<RedirectOut>,
Closes the declaration with redirect output meaning.
Source§impl<Handler, Inputs, Args, Transform> Operation<Handler, Inputs, Args, Transform>
impl<Handler, Inputs, Args, Transform> Operation<Handler, Inputs, Args, Transform>
Sourcepub fn get(self, path: &str) -> Endpoint<Get, Handler, Inputs, Args, Transform>
pub fn get(self, path: &str) -> Endpoint<Get, Handler, Inputs, Args, Transform>
Declares this operation at an exact path, answered under GET.
This is the same thing the declaration of that name on RouteProgram states,
for one endpoint standing on its own rather than one inside a composition.
Sourcepub fn post(
self,
path: &str,
) -> Endpoint<Post, Handler, Inputs, Args, Transform>
pub fn post( self, path: &str, ) -> Endpoint<Post, Handler, Inputs, Args, Transform>
Declares this operation at an exact path, answered under POST.
This is the same thing the declaration of that name on RouteProgram states,
for one endpoint standing on its own rather than one inside a composition.
Sourcepub fn put(self, path: &str) -> Endpoint<Put, Handler, Inputs, Args, Transform>
pub fn put(self, path: &str) -> Endpoint<Put, Handler, Inputs, Args, Transform>
Declares this operation at an exact path, answered under PUT.
This is the same thing the declaration of that name on RouteProgram states,
for one endpoint standing on its own rather than one inside a composition.
Sourcepub fn patch(
self,
path: &str,
) -> Endpoint<Patch, Handler, Inputs, Args, Transform>
pub fn patch( self, path: &str, ) -> Endpoint<Patch, Handler, Inputs, Args, Transform>
Declares this operation at an exact path, answered under PATCH.
This is the same thing the declaration of that name on RouteProgram states,
for one endpoint standing on its own rather than one inside a composition.
Sourcepub fn delete(
self,
path: &str,
) -> Endpoint<Delete, Handler, Inputs, Args, Transform>
pub fn delete( self, path: &str, ) -> Endpoint<Delete, Handler, Inputs, Args, Transform>
Declares this operation at an exact path, answered under DELETE.
This is the same thing the declaration of that name on RouteProgram states,
for one endpoint standing on its own rather than one inside a composition.
Sourcepub fn head(
self,
path: &str,
) -> Endpoint<Head, Handler, Inputs, Args, Transform>
pub fn head( self, path: &str, ) -> Endpoint<Head, Handler, Inputs, Args, Transform>
Declares this operation at an exact path, answered under HEAD.
This is the same thing the declaration of that name on RouteProgram states,
for one endpoint standing on its own rather than one inside a composition.
Sourcepub fn options(
self,
path: &str,
) -> Endpoint<Options, Handler, Inputs, Args, Transform>
pub fn options( self, path: &str, ) -> Endpoint<Options, Handler, Inputs, Args, Transform>
Declares this operation at an exact path, answered under OPTIONS.
This is the same thing the declaration of that name on RouteProgram states,
for one endpoint standing on its own rather than one inside a composition.
Sourcepub fn trace(
self,
path: &str,
) -> Endpoint<Trace, Handler, Inputs, Args, Transform>
pub fn trace( self, path: &str, ) -> Endpoint<Trace, Handler, Inputs, Args, Transform>
Declares this operation at an exact path, answered under TRACE.
This is the same thing the declaration of that name on RouteProgram states,
for one endpoint standing on its own rather than one inside a composition.
Sourcepub fn connect(
self,
path: &str,
) -> Endpoint<Connect, Handler, Inputs, Args, Transform>
pub fn connect( self, path: &str, ) -> Endpoint<Connect, Handler, Inputs, Args, Transform>
Declares this operation at an exact path, answered under CONNECT.
This is the same thing the declaration of that name on RouteProgram states,
for one endpoint standing on its own rather than one inside a composition.
Trait Implementations§
Auto Trait Implementations§
impl<Handler, Inputs, Args, Transform> Freeze for Operation<Handler, Inputs, Args, Transform>
impl<Handler, Inputs, Args, Transform> RefUnwindSafe for Operation<Handler, Inputs, Args, Transform>
impl<Handler, Inputs, Args, Transform> Send for Operation<Handler, Inputs, Args, Transform>
impl<Handler, Inputs, Args, Transform> Sync for Operation<Handler, Inputs, Args, Transform>
impl<Handler, Inputs, Args, Transform> Unpin for Operation<Handler, Inputs, Args, Transform>
impl<Handler, Inputs, Args, Transform> UnsafeUnpin for Operation<Handler, Inputs, Args, Transform>
impl<Handler, Inputs, Args, Transform> UnwindSafe for Operation<Handler, Inputs, Args, Transform>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<This> HttpOperationExt<This> for This
impl<This> HttpOperationExt<This> for This
Source§impl<This> HttpProgramExt<This> for This
impl<This> HttpProgramExt<This> for This
Source§fn program<Program>(&self, program: Program) -> Routes<'_, This>
fn program<Program>(&self, program: Program) -> Routes<'_, This>
Interprets a named program for further route composition.
Source§fn compile_http<Program>(
&self,
program: Program,
) -> <Program as HttpProgramAlg<This>>::Routewhere
Program: HttpProgramAlg<This>,
fn compile_http<Program>(
&self,
program: Program,
) -> <Program as HttpProgramAlg<This>>::Routewhere
Program: HttpProgramAlg<This>,
Compiles a named HTTP program with this interpreter.