pub struct RequestHandler<GivenHandler, Args, State>where
GivenHandler: Handler<Args, State> + Clone + Send + Sync + 'static,
State: Clone + Send + Sync + 'static,
Args: Clone + Send + Sync + 'static,{ /* private fields */ }Expand description
A struct that lets us bridge intrepid handlers to axum handlers.
Implementations§
Source§impl<GivenHandler, Args, State> RequestHandler<GivenHandler, Args, State>
impl<GivenHandler, Args, State> RequestHandler<GivenHandler, Args, State>
Trait Implementations§
Source§impl<GivenHandler, Args, State> Clone for RequestHandler<GivenHandler, Args, State>
impl<GivenHandler, Args, State> Clone for RequestHandler<GivenHandler, Args, State>
Source§fn clone(&self) -> RequestHandler<GivenHandler, Args, State>
fn clone(&self) -> RequestHandler<GivenHandler, Args, State>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<GivenHandler, Args, State> Handler<Args, State> for RequestHandler<GivenHandler, Args, State>
impl<GivenHandler, Args, State> Handler<Args, State> for RequestHandler<GivenHandler, Args, State>
Source§type Future = FrameFuture
type Future = FrameFuture
Action futures must resolve into an Frame of some kind.
Source§fn invoke(&self, frame: impl Into<Frame>, state: State) -> Self::Future
fn invoke(&self, frame: impl Into<Frame>, state: State) -> Self::Future
Invoke the action with a given frame and state, returning the frameual
frame that will be produced by the action.
Source§fn context(&self) -> ActionContext<State>
fn context(&self) -> ActionContext<State>
Poll for the action context. This is normally a service, but in some cases,
it may be a frame handler or a router.
Source§fn http_handler(&self) -> RequestHandler<Self, Args, State>
fn http_handler(&self) -> RequestHandler<Self, Args, State>
Create a new
RequestHandler from the action. This is a struct that implements
the axum Handler trait, and therefore can be used as a route handler.Source§fn as_into_actionable(&self) -> BoxedAction<State>
fn as_into_actionable(&self) -> BoxedAction<State>
Convert this action into a type erased actionable service.
Source§fn into_stream(
self,
state: State,
) -> (impl Stream<Item = Result<Frame>>, FrameOutbox)
fn into_stream( self, state: State, ) -> (impl Stream<Item = Result<Frame>>, FrameOutbox)
Use
into_stream to turn the action into a stream and a stream handle. See
[Actionable::into_stream] for more information.Source§fn ready(self, state: State) -> ReadyAction<Self, Args, State>
fn ready(self, state: State) -> ReadyAction<Self, Args, State>
Use
with_state to turn the action into a stateful action, which can be used
as a tower::Service.Source§fn candidate(self) -> CandidateAction<Self, Args, State>
fn candidate(self) -> CandidateAction<Self, Args, State>
Create a Candidate actionable from the action, with the given state. Candidates
can be “suspended” by boxing them for later.
Source§impl<GivenHandler, Args, State> Handler<Args, State> for RequestHandler<GivenHandler, Args, State>
impl<GivenHandler, Args, State> Handler<Args, State> for RequestHandler<GivenHandler, Args, State>
Source§type Future = Pin<Box<dyn Future<Output = Response<Body>> + Send>>
type Future = Pin<Box<dyn Future<Output = Response<Body>> + Send>>
The type of future calling this handler returns.
Source§fn call(self, request: Request<Body>, state: State) -> Self::Future
fn call(self, request: Request<Body>, state: State) -> Self::Future
Call the handler with the given request.
Source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
Apply a
tower::Layer to the handler. Read moreSource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Convert the handler into a
Service by providing the stateAuto Trait Implementations§
impl<GivenHandler, Args, State> Freeze for RequestHandler<GivenHandler, Args, State>where
GivenHandler: Freeze,
impl<GivenHandler, Args, State> RefUnwindSafe for RequestHandler<GivenHandler, Args, State>
impl<GivenHandler, Args, State> Send for RequestHandler<GivenHandler, Args, State>
impl<GivenHandler, Args, State> Sync for RequestHandler<GivenHandler, Args, State>
impl<GivenHandler, Args, State> Unpin for RequestHandler<GivenHandler, Args, State>
impl<GivenHandler, Args, State> UnwindSafe for RequestHandler<GivenHandler, Args, State>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
Source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Convert the handler into a
Service and no state.Source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
Convert the handler into a
MakeService and no state. Read moreSource§fn into_make_service_with_connect_info<C>(
self,
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
Convert the handler into a
MakeService which stores information
about the incoming connection and has no state. Read more