pub struct RouteSpec {
pub pattern: Regex,
pub name: &'static str,
}Expand description
A single named URL pattern. The pattern is anchored on both
ends (^…$) by the constructor; callers can lean on
^ / $ themselves but don’t have to.
Suffix-relative — when the rendered page’s url_path is
/blog, a request to /blog/archive/2026 matches a route
pattern of ^archive/(?P<year>\d+)$.
Fields§
§pattern: Regex§name: &'static strImplementations§
Source§impl RouteSpec
impl RouteSpec
Sourcepub fn new(pattern: &str, name: &'static str) -> Self
pub fn new(pattern: &str, name: &'static str) -> Self
Construct a route. The pattern is anchored automatically
(^…$) so handlers don’t have to remember the anchors. On
invalid regex the call panics — callers are expected to
declare these as static-shape strings at handler-build
time, so a malformed pattern is a bug, not a runtime
recoverable.
Trait Implementations§
Auto Trait Implementations§
impl Forget for RouteSpec
impl Freeze for RouteSpec
impl RefUnwindSafe for RouteSpec
impl Send for RouteSpec
impl Sync for RouteSpec
impl Unpin for RouteSpec
impl UnsafeUnpin for RouteSpec
impl UnwindSafe for RouteSpec
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 moreCreates a shared type from an unshared type.