pub struct RoutePattern {
pub pattern: String,
pub segments: Vec<PathSegment>,
pub has_path_converter: bool,
}Expand description
A parsed route pattern.
Fields§
§pattern: StringThe original path pattern string.
segments: Vec<PathSegment>Parsed segments.
has_path_converter: boolWhether the last segment is a path converter (captures slashes).
Implementations§
Source§impl RoutePattern
impl RoutePattern
Sourcepub fn match_path<'a>(&self, path: &'a str) -> Option<Vec<(String, &'a str)>>
pub fn match_path<'a>(&self, path: &'a str) -> Option<Vec<(String, &'a str)>>
Try to match this pattern against a path, extracting parameters.
Returns Some(params) if the path matches, None otherwise.
Parameter names are owned strings, values are borrowed from the path.
Sourcepub fn could_match(&self, path: &str) -> bool
pub fn could_match(&self, path: &str) -> bool
Check if this pattern could potentially match the given path (ignoring method).
Used for 405 Method Not Allowed detection.
Trait Implementations§
Source§impl Clone for RoutePattern
impl Clone for RoutePattern
Source§fn clone(&self) -> RoutePattern
fn clone(&self) -> RoutePattern
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 moreAuto Trait Implementations§
impl Freeze for RoutePattern
impl RefUnwindSafe for RoutePattern
impl Send for RoutePattern
impl Sync for RoutePattern
impl Unpin for RoutePattern
impl UnwindSafe for RoutePattern
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: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).