Skip to main content

OpenApiHandlerImpl

Struct OpenApiHandlerImpl 

Source
pub struct OpenApiHandlerImpl<Context> { /* private fields */ }
Expand description

Interprets typed HTTP programs as the OpenAPI document that describes them.

Nothing is applied. Every endpoint is read for what a caller would have to state and what it would be answered with, which is why this interpretation asks for shapes where the others ask for extractors.

Implementations§

Source§

impl<Context> OpenApiHandlerImpl<Context>

Source

pub fn new() -> Self

Describes a surface, naming shapes where an OpenAPI document keeps them.

Source

pub fn document( &self, title: &str, version: &str, route: &OpenApiRoute, ) -> Value

Returns the whole document for a surface, under a title and a version.

Trait Implementations§

Source§

impl<Context> BytesOutAlg for OpenApiHandlerImpl<Context>

Source§

type Bytes<From> = OpenApiBytesOutput

The raw-byte converter selected for From.
Source§

impl<Context> Default for OpenApiHandlerImpl<Context>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Context> EmptyOutAlg for OpenApiHandlerImpl<Context>

Source§

type Empty<From> = OpenApiEmptyOutput

The empty converter selected for From.
Source§

impl<Context> FileOutAlg for OpenApiHandlerImpl<Context>

Source§

type File<From> = OpenApiFileOutput

The streamed-file converter selected for From.
Source§

impl<Context> HandlerAlg for OpenApiHandlerImpl<Context>

Source§

type Endpoint = OpenApiEndpoint

The interpreter’s homogeneous endpoint representation.
Source§

impl<Context> HandlerContextAlg<Context> for OpenApiHandlerImpl<Context>
where Context: Send + Sync + 'static,

Source§

type Handle = Arc<Context>

The owned carrier cloned into asynchronous operation invocations.
Source§

impl<Context, Inputs, Args, Transform, Answering, Output> HandlerEndpointAlg<Arc<Context>, Inputs, Args, Transform, Output> for OpenApiHandlerImpl<Context>
where Context: Send + Sync + 'static, Inputs: OpenApiInputsAlg, Transform: OutputKindAlg<Self, Output, Transform = Answering>, Answering: OpenApiOutputAlg<Output>,

Source§

fn finish_handler<Handler>( &self, _handler: Handler, ) -> <Self as HandlerAlg>::Endpoint
where Handler: OperationAlg + ApplyAlg<Arc<Context>, Args, Output = Output> + Send + Sync + 'static,

Interprets a typed first-order handler as a concrete endpoint. Read more
Source§

impl<Context> HeaderOutAlg for OpenApiHandlerImpl<Context>

Source§

type Header<Inner, Name> = OpenApiHeaderOutput<Inner, Name>

The converter writing Name beside the body Inner states.
Source§

impl<Context> HtmlOutAlg for OpenApiHandlerImpl<Context>

Source§

type Html<From> = OpenApiHtmlOutput

The HTML converter selected for From.
Source§

impl<Context> HttpInputAlg for OpenApiHandlerImpl<Context>

Source§

type Path<I> = OpenApiPathInput<I>

The interpreter’s path extractor for Input.
Source§

type Query<I> = OpenApiQueryInput<I>

The interpreter’s query extractor for Input.
Source§

type Body<I> = OpenApiBodyInput<I>

The interpreter’s request-body extractor for Input.
Source§

type Form<I> = OpenApiFormInput<I>

The interpreter’s form-encoded request-body extractor for Input.
Source§

type Multipart<I> = OpenApiMultipartInput<I>

The interpreter’s extractor for Input read from a body arriving as parts.
Source§

type RawBody<I> = OpenApiRawBodyInput<I>

The interpreter’s unread request-body extractor for Input.
Source§

type Header<I> = OpenApiHeaderInput<I>

The interpreter’s header extractor for Input. Read more
Source§

type Cookie<I> = OpenApiCookieInput<I>

The interpreter’s cookie extractor for Input.
Source§

type Auth<I> = OpenApiHeaderInput<I>

The interpreter’s authentication extractor for Input.
Source§

type Context<I> = OpenApiUnstatedInput<I>

The interpreter’s endpoint-context extractor for Input.
Source§

impl<Context> HttpSelectorAlg for OpenApiHandlerImpl<Context>

Source§

type Selector = OpenApiSelector

The interpreter’s HTTP selector representation.
Source§

fn http_method(&self, method: HttpMethod) -> Self::Selector

Interprets a request-method selector.
Source§

fn http_path(&self, path: &RoutePath) -> Self::Selector

Interprets an exact path selector.
Source§

fn http_prefix(&self, prefix: &RoutePath) -> Self::Selector

Interprets a path-prefix selector.
Source§

impl<Context> JsonOutAlg for OpenApiHandlerImpl<Context>

Source§

type Json<From> = OpenApiJsonOutput

The JSON converter selected for From.
Source§

impl<Context> RedirectOutAlg for OpenApiHandlerImpl<Context>

Source§

type Redirect<From> = OpenApiRedirectOutput

The redirect converter selected for From.
Source§

impl<Context> ResultOutAlg for OpenApiHandlerImpl<Context>

Source§

type Result<Inner, Error> = OpenApiResultOutput<Inner, Error>

The converter answering with Inner on success and with what Error means otherwise.
Source§

impl<Context> RouteAlg for OpenApiHandlerImpl<Context>

Source§

type Route = OpenApiRoute

The interpreter’s composed route representation.
Source§

type Selector = OpenApiSelector

The selector applied to a route or endpoint.
Source§

type Endpoint = OpenApiEndpoint

The homogeneous endpoint representation lifted into routes.
Source§

fn initial(&self) -> Self::Route

Returns the initial route.
Source§

fn coproduct(&self, left: Self::Route, right: Self::Route) -> Self::Route

Forms the coproduct of two routes.
Source§

fn precompose( &self, selector: Self::Selector, route: Self::Route, ) -> Self::Route

Precomposes a route with a selector.
Source§

fn lift(&self, endpoint: Self::Endpoint) -> Self::Route

Lifts an endpoint into a route.
Source§

impl<Context> SelectorAlg for OpenApiHandlerImpl<Context>

Source§

type Selector = OpenApiSelector

The interpreter’s selector representation.
Source§

fn identity(&self) -> Self::Selector

Returns the selector identity.
Source§

fn compose( &self, first: Self::Selector, second: Self::Selector, ) -> Self::Selector

Composes two selectors from left to right.
Source§

impl<Context> StatusOutAlg for OpenApiHandlerImpl<Context>

Source§

type Status<Inner, const CODE: u16> = OpenApiStatusOutput<Inner, CODE>

The converter answering with CODE and the body Inner states.
Source§

impl<Context> StreamOutAlg for OpenApiHandlerImpl<Context>

Source§

type Stream<From> = OpenApiStreamOutput

The streamed converter selected for From.
Source§

impl<Context> TextOutAlg for OpenApiHandlerImpl<Context>

Source§

type Text<From> = OpenApiTextOutput

The plain-text converter selected for From.

Auto Trait Implementations§

§

impl<Context> !Freeze for OpenApiHandlerImpl<Context>

§

impl<Context> !RefUnwindSafe for OpenApiHandlerImpl<Context>

§

impl<Context> !Sync for OpenApiHandlerImpl<Context>

§

impl<Context> Send for OpenApiHandlerImpl<Context>
where PhantomData<fn() -> Context>: Send,

§

impl<Context> Unpin for OpenApiHandlerImpl<Context>
where PhantomData<fn() -> Context>: Unpin,

§

impl<Context> UnsafeUnpin for OpenApiHandlerImpl<Context>
where PhantomData<fn() -> Context>: UnsafeUnpin,

§

impl<Context> UnwindSafe for OpenApiHandlerImpl<Context>
where PhantomData<fn() -> Context>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<_INNER> HttpApiAlg for _INNER
where _INNER: HandlerAlg + HttpInputAlg + HttpRouteAlg<Endpoint = <_INNER as HandlerAlg>::Endpoint> + RouteAlg,

Source§

impl<This> HttpProgramExt<This> for This

Source§

fn compile_http<Program>( &self, program: Program, ) -> <Program as HttpProgramAlg<This>>::Route
where Program: HttpProgramAlg<This>,

Compiles a named HTTP program with this interpreter.

Source§

impl<_INNER> HttpRouteAlg for _INNER
where _INNER: HttpSelectorAlg<Selector = <_INNER as SelectorAlg>::Selector> + RouteAlg<Selector = <_INNER as SelectorAlg>::Selector> + SelectorAlg,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<This> RouteAlgExt<This> for This
where This: RouteAlg,

Source§

fn routes(&self) -> Routes<'_, This>

Starts with the initial route.

Source§

fn route(&self, route: <This as RouteAlg>::Route) -> Routes<'_, This>

Wraps an already interpreted route for further fluent composition.

Source§

impl<This> ShapeProgramExt<This> for This

Source§

fn compile_shape<Program>( &self, program: Program, ) -> <Program as ShapeProgramAlg<This>>::Ty
where Program: ShapeProgramAlg<This>,

Folds a declaration with this interpretation.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.