Skip to main content

Bundle

Struct Bundle 

Source
#[repr(C)]
pub struct Bundle<Req, State = State, Res = ()> { pub request: Req, pub response: Res, pub stop_flag: StopFlag, pub state: State, }
Expand description

The container passed through the handler chain, carrying the request, response, state, and a stop flag.

Fields§

§request: Req

The request being processed.

§response: Res

The response being built.

§stop_flag: StopFlag

A flag to stop the chain.

§state: State

The state shared across handlers.

Implementations§

Source§

impl<Req, State, Res> Bundle<Req, State, Res>

Source

pub fn new(request: Req, state: State, response: Res) -> Self

Create a bundle from a request, state, and response.

Trait Implementations§

Source§

impl<Req: Debug, State: Debug, Res: Debug> Debug for Bundle<Req, State, Res>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Req, State, Res> FromRequest<Req, State, Res> for &mut Bundle<Req, State, Res>
where Req: Send, State: Send, Res: Send,

Source§

fn from_request(bundle: &mut Bundle<Req, State, Res>) -> Option<Self>

Extract this value from the bundle.
Source§

impl<Req, State, Res> Service<Bundle<Req, State, Res>> for TowerHandler<Req, State, Res>
where Req: Send + 'static, State: Send + 'static, Res: Send + 'static,

Source§

type Response = Bundle<Req, State, Res>

Responses given by the service.
Source§

type Error = !

Errors produced by the service.
Source§

type Future = Pin<Box<dyn Future<Output = Result<Bundle<Req, State, Res>, !>> + Send>>

The future response value.
Source§

fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>

Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more
Source§

fn call(&mut self, bundle: Bundle<Req, State, Res>) -> Self::Future

Process the request and return the response asynchronously. Read more

Auto Trait Implementations§

§

impl<Req, State, Res> Freeze for Bundle<Req, State, Res>
where Req: Freeze, Res: Freeze, State: Freeze,

§

impl<Req, State, Res> RefUnwindSafe for Bundle<Req, State, Res>
where Req: RefUnwindSafe, Res: RefUnwindSafe, State: RefUnwindSafe,

§

impl<Req, State, Res> Send for Bundle<Req, State, Res>
where Req: Send, Res: Send, State: Send,

§

impl<Req, State, Res> Sync for Bundle<Req, State, Res>
where Req: Sync, Res: Sync, State: Sync,

§

impl<Req, State, Res> Unpin for Bundle<Req, State, Res>
where Req: Unpin, Res: Unpin, State: Unpin,

§

impl<Req, State, Res> UnsafeUnpin for Bundle<Req, State, Res>
where Req: UnsafeUnpin, Res: UnsafeUnpin, State: UnsafeUnpin,

§

impl<Req, State, Res> UnwindSafe for Bundle<Req, State, Res>
where Req: UnwindSafe, Res: UnwindSafe, State: 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<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<T> IntoResponse<T> for T
where T: Send,

Source§

fn into_response(self) -> T

Convert this value into a response.
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> WithSubState<T> for T