[−][src]Struct matchit::Node
A node in radix tree ordered by priority.
Priority is just the number of values registered in sub nodes (children, grandchildren, and so on..).
Implementations
impl<V> Node<V>
[src]
pub fn insert(&mut self, path: &str, value: V)
[src]
Insert a Node
with the given value to the path.
pub fn match_path(&self, path: &str) -> Result<Match<'_, V>, bool>
[src]
Returns the value registered with the given path.
If no value can be found, an Err(bool)
is returned which represents a TSR (trailing slash
redirect) recommendation.
let mut matcher = Node::default(); matcher.insert("/home", "Welcome!"); if let Err(matched) = matcher.match_path("/home/") { assert_eq!(matched, true); }
pub fn find_case_insensitive_path(
&self,
path: &str,
fix_trailing_slash: bool
) -> Option<String>
[src]
&self,
path: &str,
fix_trailing_slash: bool
) -> Option<String>
Makes a case-insensitive match of the given path and tries to find a handler. It can optionally also fix trailing slashes. It returns the case-corrected path and a bool indicating whether the match was successful.
let mut matcher = Node::default(); matcher.insert("/home", "Welcome!"); let path = matcher.find_case_insensitive_path("/HoMe/", true).unwrap(); assert_eq!(path, "/home");
Trait Implementations
Auto Trait Implementations
impl<V> RefUnwindSafe for Node<V> where
V: RefUnwindSafe,
[src]
V: RefUnwindSafe,
impl<V> Send for Node<V> where
V: Send,
[src]
V: Send,
impl<V> Sync for Node<V> where
V: Sync,
[src]
V: Sync,
impl<V> Unpin for Node<V> where
V: Unpin,
[src]
V: Unpin,
impl<V> UnwindSafe for Node<V> where
V: UnwindSafe,
[src]
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,