pub struct HttpWardMiddlewarePipe { /* private fields */ }Expand description
Public wrapper around shared pipeline storage. The internal Vec is wrapped in an Arc so cloning the pipe is cheap (one atomic increment).
Implementations§
Source§impl HttpWardMiddlewarePipe
impl HttpWardMiddlewarePipe
pub fn is_empty(&self) -> bool
Sourcepub fn add_layer<M>(&self, mw: M) -> Self
pub fn add_layer<M>(&self, mw: M) -> Self
Add a middleware to the pipe (returns a new pipe for builder pattern compatibility)
Sourcepub fn add_boxed_layer(&self, mw: Arc<dyn HttpWardMiddleware>) -> Self
pub fn add_boxed_layer(&self, mw: Arc<dyn HttpWardMiddleware>) -> Self
Add a boxed middleware (Arc
Sourcepub fn get_layer_by_name(
&self,
name: &str,
) -> Option<&Arc<dyn HttpWardMiddleware>>
pub fn get_layer_by_name( &self, name: &str, ) -> Option<&Arc<dyn HttpWardMiddleware>>
Find layer by name (middleware may return a name via name()).
Returns a reference to the boxed middleware if found.
Sourcepub async fn execute_middleware<S>(
&self,
inner: S,
ctx: Context<()>,
req: Request<Body>,
) -> Result<Response<Body>, BoxError>
pub async fn execute_middleware<S>( &self, inner: S, ctx: Context<()>, req: Request<Body>, ) -> Result<Response<Body>, BoxError>
Execute the middleware chain for a concrete inner service S.
This converts the concrete inner service to a boxed type (BoxService) once,
borrows a slice from the internal Arc<Vec<…>> and runs the optimized Next.
Hot path: no atomic ops per middleware.
Trait Implementations§
Source§impl Clone for HttpWardMiddlewarePipe
impl Clone for HttpWardMiddlewarePipe
Source§fn clone(&self) -> HttpWardMiddlewarePipe
fn clone(&self) -> HttpWardMiddlewarePipe
Returns a duplicate 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 Debug for HttpWardMiddlewarePipe
impl Debug for HttpWardMiddlewarePipe
Auto Trait Implementations§
impl Freeze for HttpWardMiddlewarePipe
impl !RefUnwindSafe for HttpWardMiddlewarePipe
impl Send for HttpWardMiddlewarePipe
impl Sync for HttpWardMiddlewarePipe
impl Unpin for HttpWardMiddlewarePipe
impl UnsafeUnpin for HttpWardMiddlewarePipe
impl !UnwindSafe for HttpWardMiddlewarePipe
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more