pub struct MiddlewareRegistry { /* private fields */ }Expand description
Registry for storing and managing dual-phase middleware instances.
Middleware is kept sorted by priority at all times so that get_sorted
is a zero-cost borrow of the internal slice — no allocation or sort on
every request.
Implementations§
Source§impl MiddlewareRegistry
impl MiddlewareRegistry
Sourcepub fn register_inbound<M: InboundMiddleware>(
&mut self,
name: &str,
middleware: M,
)
pub fn register_inbound<M: InboundMiddleware>( &mut self, name: &str, middleware: M, )
Register an inbound-only middleware
Sourcepub fn register_outbound<M: OutboundMiddleware>(
&mut self,
name: &str,
middleware: M,
)
pub fn register_outbound<M: OutboundMiddleware>( &mut self, name: &str, middleware: M, )
Register an outbound-only middleware
Sourcepub fn register_dual<M>(&mut self, name: &str, middleware: M)
pub fn register_dual<M>(&mut self, name: &str, middleware: M)
Register a dual-phase middleware
Sourcepub fn register<M>(&mut self, name: &str, middleware: M)
pub fn register<M>(&mut self, name: &str, middleware: M)
Compatibility method for old code - converts to dual phase
Sourcepub fn get_sorted(&self) -> &[DualPhaseMiddlewareInstance]
pub fn get_sorted(&self) -> &[DualPhaseMiddlewareInstance]
Return middleware in priority order. Zero-cost — already sorted.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for MiddlewareRegistry
impl !UnwindSafe for MiddlewareRegistry
impl Freeze for MiddlewareRegistry
impl Send for MiddlewareRegistry
impl Sync for MiddlewareRegistry
impl Unpin for MiddlewareRegistry
impl UnsafeUnpin for MiddlewareRegistry
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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