pub struct GroupAttributes { /* private fields */ }Expand description
Attributes shared by every route declared inside a
group.
Implementations§
Source§impl GroupAttributes
impl GroupAttributes
Sourcepub fn new() -> GroupAttributes
pub fn new() -> GroupAttributes
No attributes.
Sourcepub fn prefix(self, prefix: impl Into<String>) -> GroupAttributes
pub fn prefix(self, prefix: impl Into<String>) -> GroupAttributes
Prepend a URI prefix to every route in the group.
Sourcepub fn name(self, prefix: impl Into<String>) -> GroupAttributes
pub fn name(self, prefix: impl Into<String>) -> GroupAttributes
Prepend a name prefix (conventionally ending in .) to every named
route in the group.
Sourcepub fn middleware(self, middleware: impl IntoMiddlewareStack) -> GroupAttributes
pub fn middleware(self, middleware: impl IntoMiddlewareStack) -> GroupAttributes
Apply middleware to every route in the group, outside their own.
Takes the middleware itself, so a group is a function returning a
MiddlewareStack rather than a name in a registry:
ⓘ
router.group(GroupAttributes::new().prefix("api").middleware(kernel::api()), |router| {
router.get("/posts", index);
});Sourcepub fn where_param(
self,
param: impl Into<String>,
constraint: ParamConstraint,
) -> GroupAttributes
pub fn where_param( self, param: impl Into<String>, constraint: ParamConstraint, ) -> GroupAttributes
Apply a parameter constraint to every route in the group that does not set its own.
Trait Implementations§
Source§impl Clone for GroupAttributes
impl Clone for GroupAttributes
Source§fn clone(&self) -> GroupAttributes
fn clone(&self) -> GroupAttributes
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 GroupAttributes
impl Debug for GroupAttributes
Source§impl Default for GroupAttributes
impl Default for GroupAttributes
Source§fn default() -> GroupAttributes
fn default() -> GroupAttributes
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for GroupAttributes
impl !UnwindSafe for GroupAttributes
impl Freeze for GroupAttributes
impl Send for GroupAttributes
impl Sync for GroupAttributes
impl Unpin for GroupAttributes
impl UnsafeUnpin for GroupAttributes
Blanket Implementations§
impl<T> Actor for T
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Event for T
impl<T> Event for T
Source§fn event_name() -> &'static strwhere
Self: Sized,
fn event_name() -> &'static strwhere
Self: Sized,
A human-readable name, used by wildcard listeners and log output.
Always the Rust type path; see the trait docs.
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 moreCreates a shared type from an unshared type.