Skip to main content

ActixHandlerImpl

Struct ActixHandlerImpl 

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

Interprets typed HTTP programs as executable actix-web routes.

Shared state reaches a handler as the semantic context the program already threads, not as actix_web::Data, because a framework composing domain code is the inversion this design exists to avoid.

Implementations§

Source§

impl<Context> ActixHandlerImpl<Context>

Source

pub fn new(context: Context) -> Self

Creates an interpreter owning a newly shared context.

Source

pub fn from_shared(context: Arc<Context>) -> Self

Creates an interpreter from an existing shared context.

Trait Implementations§

Source§

impl<Context> BytesOutAlg for ActixHandlerImpl<Context>

Source§

type Bytes<From> = ActixBytesOutput

The raw-byte converter selected for From.
Source§

impl<Context> EmptyOutAlg for ActixHandlerImpl<Context>

Source§

type Empty<From> = ActixEmptyOutput

The empty converter selected for From.
Source§

impl<Context> FileOutAlg for ActixHandlerImpl<Context>

Source§

type File<From> = ActixFileOutput

The streamed-file converter selected for From.
Source§

impl<Context> HandlerAlg for ActixHandlerImpl<Context>

Source§

type Endpoint = ActixEndpoint

The interpreter’s homogeneous endpoint representation.
Source§

impl<Context> HandlerContextAlg<Context> for ActixHandlerImpl<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 ActixHandlerImpl<Context>
where Context: Send + Sync + 'static, Inputs: ActixInputsAlg<Args> + 'static, Args: 'static, Output: 'static, Transform: OutputKindAlg<Self, Output, Transform = Answering> + 'static, Answering: OutputAlg<Output, Output = HttpResponse>,

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 ActixHandlerImpl<Context>

Source§

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

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

impl<Context> HtmlOutAlg for ActixHandlerImpl<Context>

Source§

type Html<From> = ActixHtmlOutput

The HTML converter selected for From.
Source§

impl<Context> HttpInputAlg for ActixHandlerImpl<Context>

Source§

type Path<I> = ActixPathInput<I>

The interpreter’s path extractor for Input.
Source§

type Query<I> = ActixQueryInput<I>

The interpreter’s query extractor for Input.
Source§

type Body<I> = ActixBodyInput<I>

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

type Form<I> = ActixFormInput<I>

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

type Multipart<I> = ActixMultipartInput<I>

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

type RawBody<I> = ActixRequestInput<I>

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

type Header<I> = ActixHeaderInput<I>

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

type Cookie<I> = ActixCookieInput<I>

The interpreter’s cookie extractor for Input.
Source§

type Auth<I> = ActixHeaderInput<I>

The interpreter’s authentication extractor for Input.
Source§

type Context<I> = ActixRequestInput<I>

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

impl<Context> HttpSelectorAlg for ActixHandlerImpl<Context>

Source§

type Selector = ActixSelector

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 ActixHandlerImpl<Context>

Source§

type Json<From> = ActixJsonOutput

The JSON converter selected for From.
Source§

impl<Context> RedirectOutAlg for ActixHandlerImpl<Context>

Source§

type Redirect<From> = ActixRedirectOutput

The redirect converter selected for From.
Source§

impl<Context> ResultOutAlg for ActixHandlerImpl<Context>

Source§

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

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

impl<Context> RouteAlg for ActixHandlerImpl<Context>

Source§

type Route = ActixRoute

The interpreter’s composed route representation.
Source§

type Selector = ActixSelector

The selector applied to a route or endpoint.
Source§

type Endpoint = ActixEndpoint

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 ActixHandlerImpl<Context>

Source§

type Selector = ActixSelector

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 ActixHandlerImpl<Context>

Source§

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

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

impl<Context> StreamOutAlg for ActixHandlerImpl<Context>

Source§

type Stream<From> = ActixStreamOutput

The streamed converter selected for From.
Source§

impl<Context> TextOutAlg for ActixHandlerImpl<Context>

Source§

type Text<From> = ActixTextOutput

The plain-text converter selected for From.

Auto Trait Implementations§

§

impl<Context> Freeze for ActixHandlerImpl<Context>
where Arc<Context>: Freeze,

§

impl<Context> RefUnwindSafe for ActixHandlerImpl<Context>
where Arc<Context>: RefUnwindSafe,

§

impl<Context> Send for ActixHandlerImpl<Context>
where Arc<Context>: Send,

§

impl<Context> Sync for ActixHandlerImpl<Context>
where Arc<Context>: Sync,

§

impl<Context> Unpin for ActixHandlerImpl<Context>
where Arc<Context>: Unpin,

§

impl<Context> UnsafeUnpin for ActixHandlerImpl<Context>
where Arc<Context>: UnsafeUnpin,

§

impl<Context> UnwindSafe for ActixHandlerImpl<Context>
where Arc<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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more