Struct viz_core::handler::BoxHandler

source ·
pub struct BoxHandler<I = Request, O = Result<Response>>(/* private fields */);
Expand description

A Clone + Send boxed Handler.

Implementations§

source§

impl<I, O> BoxHandler<I, O>

source

pub fn new<H>(h: H) -> Self
where H: Handler<I, Output = O> + Clone,

Creates a new BoxHandler.

Trait Implementations§

source§

impl<I, O> Clone for BoxHandler<I, O>
where I: Send + 'static, O: 'static,

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I, O> Debug for BoxHandler<I, O>

source§

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

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

impl<I, O> From<Box<dyn Cloneable<I, Output = O>>> for BoxHandler<I, O>

source§

fn from(value: Box<dyn Cloneable<I, Output = O>>) -> Self

Converts to this type from the input type.
source§

impl<I, O> Handler<I> for BoxHandler<I, O>
where I: Send + 'static, O: 'static,

§

type Output = O

The returned type after the call operator is used.
source§

fn call<'life0, 'async_trait>( &'life0 self, i: I, ) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Performs the call operation.

Auto Trait Implementations§

§

impl<I, O> Freeze for BoxHandler<I, O>

§

impl<I = Request<Body>, O = Result<Response<Body>, Error>> !RefUnwindSafe for BoxHandler<I, O>

§

impl<I, O> Send for BoxHandler<I, O>

§

impl<I, O> Sync for BoxHandler<I, O>

§

impl<I, O> Unpin for BoxHandler<I, O>

§

impl<I = Request<Body>, O = Result<Response<Body>, Error>> !UnwindSafe for BoxHandler<I, O>

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> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<I, T> HandlerExt<I> for T
where T: Handler<I> + ?Sized,

source§

fn before<F>(self, f: F) -> Before<Self, F>
where Self: Sized,

Maps the input before the handler calls.
source§

fn after<F>(self, f: F) -> After<Self, F>
where Self: Sized,

Maps the output Result<T> after the handler called.
source§

fn around<F>(self, f: F) -> Around<Self, F>
where Self: Sized,

Wraps around the remaining handler or middleware chain.
source§

fn either<R>(self, r: R, enable: bool) -> Either<Self, R>
where Self: Sized,

Wraps this handler in an Either handler, making it the left-hand variant of that Either. Read more
source§

fn map<F>(self, f: F) -> Map<Self, F>
where Self: Sized,

Maps the Ok value of the output if after the handler called.
source§

fn map_into_response(self) -> MapInToResponse<Self>
where Self: Sized,

Maps the handler’s output type to the Response.
source§

fn and_then<F>(self, f: F) -> AndThen<Self, F>
where Self: Sized,

Calls op if the result is Ok, otherwise returns the Err value of self.
source§

fn map_err<F>(self, f: F) -> MapErr<Self, F>
where Self: Sized,

Maps the Err value of the output if after the handler called.
source§

fn or_else<F>(self, f: F) -> OrElse<Self, F>
where Self: Sized,

Calls op if the output is Err, otherwise returns the Ok value of the output.
source§

fn catch_error<F, E, R>(self, f: F) -> CatchError<Self, F, E, R>
where Self: Sized,

Catches rejected error while calling the handler.
source§

fn catch_unwind<F>(self, f: F) -> CatchUnwind<Self, F>
where Self: Sized,

Catches unwinding panics while calling the handler.
source§

fn boxed(self) -> BoxHandler<I, Self::Output>
where Self: Sized + Clone,

Converts this Handler into a BoxHandler.
source§

fn with<T>(self, t: T) -> T::Output
where T: Transform<Self>, Self: Sized,

Returns a new Handler that wrapping the Self and a type implementing Transform.
source§

fn with_fn<F>(self, f: F) -> Self
where F: Fn(Self) -> Self, Self: Sized,

Maps the handler.
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<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

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