pub struct RewriteParts(/* private fields */);Expand description
A pre-parsed rewrite template, decomposed into [RewritePart]s.
RewriteParts is built once at frontend registration time
(Frontend::new) and then re-applied at lookup time via
RewriteParts::run against the captures collected by the router.
Grammar:
$HOST[N]— substitute the N-th host capture$PATH[N]— substitute the N-th path capture- any other byte sequence — substitute literally
Out-of-bounds capture indices substitute to the empty string at run
time, but RewriteParts::parse rejects templates that reference
capture indices the router cannot produce (the *_cap_cap arguments).
Implementations§
Source§impl RewriteParts
impl RewriteParts
Sourcepub fn parse(
template: &str,
host_cap_cap: usize,
path_cap_cap: usize,
used_index_host: &mut usize,
used_index_path: &mut usize,
) -> Option<Self>
pub fn parse( template: &str, host_cap_cap: usize, path_cap_cap: usize, used_index_host: &mut usize, used_index_path: &mut usize, ) -> Option<Self>
Parse template against the host/path capture caps the router can
produce for the matching domain/path rule.
host_cap_cap and path_cap_cap are upper bounds (exclusive) on the
host and path capture indices the router can fill at lookup time.
used_index_host / used_index_path are out parameters tracking the
highest index actually referenced — callers use them to short-circuit
capture extraction when no template references captures.
Returns None on syntactically malformed templates: dangling $,
missing closing ], non-digit index, or an index ≥ the cap.
Trait Implementations§
Source§impl Clone for RewriteParts
impl Clone for RewriteParts
Source§fn clone(&self) -> RewriteParts
fn clone(&self) -> RewriteParts
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RewriteParts
impl Debug for RewriteParts
impl Eq for RewriteParts
Source§impl PartialEq for RewriteParts
impl PartialEq for RewriteParts
Source§fn eq(&self, other: &RewriteParts) -> bool
fn eq(&self, other: &RewriteParts) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RewriteParts
Auto Trait Implementations§
impl Freeze for RewriteParts
impl RefUnwindSafe for RewriteParts
impl Send for RewriteParts
impl Sync for RewriteParts
impl Unpin for RewriteParts
impl UnsafeUnpin for RewriteParts
impl UnwindSafe for RewriteParts
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.