pub struct PathRouter<T> { /* private fields */ }Expand description
A typed prefix router for URI paths.
Routes are compiled as PathPattern prefix matchers and looked up directly
against PathRef, so matching does not require callers to lower-case,
trim, split, or allocate string lookup keys on the request path.
Implementations§
Source§impl<T> PathRouter<T>
impl<T> PathRouter<T>
Sourcepub fn insert_prefix(
&mut self,
pattern: impl IntoUriComponent,
value: T,
) -> Option<T>
pub fn insert_prefix( &mut self, pattern: impl IntoUriComponent, value: T, ) -> Option<T>
Insert a prefix route using default PathMatchOptions.
If pattern ends in a whole-segment catch-all ({*} / {*name}), the
catch-all is treated as “the nested target owns the remainder” and is
not counted as part of the matched prefix.
Sourcepub fn insert_prefix_with_opts(
&mut self,
pattern: impl IntoUriComponent,
opts: PathMatchOptions,
value: T,
) -> Option<T>
pub fn insert_prefix_with_opts( &mut self, pattern: impl IntoUriComponent, opts: PathMatchOptions, value: T, ) -> Option<T>
Insert a prefix route using explicit PathMatchOptions.
Re-inserting an equivalent compiled pattern replaces the stored value.
Sourcepub fn match_prefix<'a, 'p>(
&'a self,
path: PathRef<'p>,
) -> Option<PathRouteMatch<'a, 'p, T>>
pub fn match_prefix<'a, 'p>( &'a self, path: PathRef<'p>, ) -> Option<PathRouteMatch<'a, 'p, T>>
Match path against the most specific registered prefix.
Sourcepub fn match_exact<'a, 'p>(
&'a self,
path: PathRef<'p>,
) -> Option<PathRouteMatch<'a, 'p, T>>
pub fn match_exact<'a, 'p>( &'a self, path: PathRef<'p>, ) -> Option<PathRouteMatch<'a, 'p, T>>
Match path against the most specific registered route only when the
route covers the complete path.
Trait Implementations§
Source§impl<T: Clone> Clone for PathRouter<T>
impl<T: Clone> Clone for PathRouter<T>
Source§fn clone(&self) -> PathRouter<T>
fn clone(&self) -> PathRouter<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Debug> Debug for PathRouter<T>
impl<T: Debug> Debug for PathRouter<T>
Source§impl<T> Default for PathRouter<T>
impl<T> Default for PathRouter<T>
Auto Trait Implementations§
impl<T> Freeze for PathRouter<T>
impl<T> RefUnwindSafe for PathRouter<T>where
T: RefUnwindSafe,
impl<T> Send for PathRouter<T>where
T: Send,
impl<T> Sync for PathRouter<T>where
T: Sync,
impl<T> Unpin for PathRouter<T>where
T: Unpin,
impl<T> UnsafeUnpin for PathRouter<T>
impl<T> UnwindSafe for PathRouter<T>where
T: UnwindSafe,
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
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> ⓘ
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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> RamaTryFrom<T> for Uwhere
U: TryFrom<T>,
Source§impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for Twhere
U: RamaTryFrom<T, CrateMarker>,
type Error = <U as RamaTryFrom<T, CrateMarker>>::Error
fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writerSource§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writerSource§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writerSource§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writerSource§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer