pub struct ConditionalMiddleware<M> { /* private fields */ }
Expand description
Conditional middleware wrapper that can skip execution based on path patterns and HTTP methods
Implementations§
Source§impl<M> ConditionalMiddleware<M>
impl<M> ConditionalMiddleware<M>
pub fn new(middleware: M) -> Self
Sourcepub fn skip_paths(self, paths: Vec<&str>) -> Self
pub fn skip_paths(self, paths: Vec<&str>) -> Self
Skip middleware execution for paths matching these patterns Supports basic wildcards: “/api/*” matches “/api/users”, “/api/posts”, etc.
Sourcepub fn only_methods(self, methods: Vec<ElifMethod>) -> Self
pub fn only_methods(self, methods: Vec<ElifMethod>) -> Self
Only execute middleware for these HTTP methods
Trait Implementations§
Source§impl<M: Debug> Debug for ConditionalMiddleware<M>
impl<M: Debug> Debug for ConditionalMiddleware<M>
Source§impl<M: Middleware> Middleware for ConditionalMiddleware<M>
impl<M: Middleware> Middleware for ConditionalMiddleware<M>
Source§fn handle(&self, request: ElifRequest, next: Next) -> NextFuture<'static>
fn handle(&self, request: ElifRequest, next: Next) -> NextFuture<'static>
Handle the request and call the next middleware in the chain
Auto Trait Implementations§
impl<M> Freeze for ConditionalMiddleware<M>where
M: Freeze,
impl<M> !RefUnwindSafe for ConditionalMiddleware<M>
impl<M> Send for ConditionalMiddleware<M>where
M: Send,
impl<M> Sync for ConditionalMiddleware<M>where
M: Sync,
impl<M> Unpin for ConditionalMiddleware<M>where
M: Unpin,
impl<M> !UnwindSafe for ConditionalMiddleware<M>
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