pub struct RouteBuilder { /* private fields */ }Expand description
Builder for configuring a single route (without host scope).
Created by RateLimitBuilder::route closure. Configure the route and
the closure will automatically add it to the middleware.
Implementations§
Source§impl RouteBuilder
impl RouteBuilder
Sourcepub fn host(self, host: impl Into<String>) -> Self
pub fn host(self, host: impl Into<String>) -> Self
Set the host to match (e.g., “api.example.com”).
Note: Consider using RateLimitBuilder::host instead if you’re
configuring multiple routes for the same host.
Sourcepub fn path(self, path_prefix: impl Into<String>) -> Self
pub fn path(self, path_prefix: impl Into<String>) -> Self
Set the path prefix to match (e.g., “/order”).
Sourcepub fn on_limit(self, behavior: ThrottleBehavior) -> Self
pub fn on_limit(self, behavior: ThrottleBehavior) -> Self
Set the behavior when rate limit is exceeded.
Trait Implementations§
Source§impl Clone for RouteBuilder
impl Clone for RouteBuilder
Source§fn clone(&self) -> RouteBuilder
fn clone(&self) -> RouteBuilder
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 RouteBuilder
impl Debug for RouteBuilder
Source§impl Default for RouteBuilder
impl Default for RouteBuilder
Source§fn default() -> RouteBuilder
fn default() -> RouteBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RouteBuilder
impl RefUnwindSafe for RouteBuilder
impl Send for RouteBuilder
impl Sync for RouteBuilder
impl Unpin for RouteBuilder
impl UnwindSafe for RouteBuilder
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