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<NewTransform>(self) -> Operation<Handler, Inputs, Args, NewTransform>
pub fn out<NewTransform>(self) -> Operation<Handler, Inputs, Args, NewTransform>
Replaces the declaration’s output-kind marker without converting a value.
The selected kind is interpreted only after the handler result type is known at the compilation boundary.
Sourcepub fn json(self) -> Operation<Handler, Inputs, Args, JsonOut>
pub fn json(self) -> Operation<Handler, Inputs, Args, JsonOut>
Marks the inferred handler result for JSON interpretation.
Sourcepub fn file(self) -> Operation<Handler, Inputs, Args, FileOut>
pub fn file(self) -> Operation<Handler, Inputs, Args, FileOut>
Marks the inferred handler result for streamed-file interpretation.
Sourcepub fn text(self) -> Operation<Handler, Inputs, Args, TextOut>
pub fn text(self) -> Operation<Handler, Inputs, Args, TextOut>
Marks the inferred handler result for plain-text interpretation.
Sourcepub fn html(self) -> Operation<Handler, Inputs, Args, HtmlOut>
pub fn html(self) -> Operation<Handler, Inputs, Args, HtmlOut>
Marks the inferred handler result for HTML interpretation.
Sourcepub fn bytes(self) -> Operation<Handler, Inputs, Args, BytesOut>
pub fn bytes(self) -> Operation<Handler, Inputs, Args, BytesOut>
Marks the inferred handler result for raw-byte interpretation.
Sourcepub fn empty(self) -> Operation<Handler, Inputs, Args, EmptyOut>
pub fn empty(self) -> Operation<Handler, Inputs, Args, EmptyOut>
Marks the inferred handler result for empty interpretation.
Sourcepub fn redirect(self) -> Operation<Handler, Inputs, Args, RedirectOut>
pub fn redirect(self) -> Operation<Handler, Inputs, Args, RedirectOut>
Marks the inferred handler result for redirect interpretation.
Sourcepub fn stream(self) -> Operation<Handler, Inputs, Args, StreamOut>
pub fn stream(self) -> Operation<Handler, Inputs, Args, StreamOut>
Marks the inferred handler result for streamed interpretation.
Sourcepub fn status<const CODE: u16>(
self,
) -> Operation<Handler, Inputs, Args, StatusOut<Transform, CODE>>
pub fn status<const CODE: u16>( self, ) -> Operation<Handler, Inputs, Args, StatusOut<Transform, CODE>>
Answers with CODE and the body already stated.
Sourcepub fn out_header<Name>(
self,
) -> Operation<Handler, Inputs, Args, HeaderOut<Transform, Name>>
pub fn out_header<Name>( self, ) -> Operation<Handler, Inputs, Args, HeaderOut<Transform, Name>>
Answers with an outgoing response header the handler states, beside the body already stated.
The handler answers with the header’s value and the body, so a value an endpoint cannot know is one the handler still states.
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> HttpProgramExt<This> for This
impl<This> HttpProgramExt<This> for This
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.