Struct dioxus_router::UseRoute
source · [−]pub struct UseRoute { /* private fields */ }Expand description
A handle to the current location of the router.
Implementations
sourceimpl UseRoute
impl UseRoute
sourcepub fn query<T: DeserializeOwned>(&self) -> Option<T>
pub fn query<T: DeserializeOwned>(&self) -> Option<T>
Get the first query parameter given the parameter name.
If you need to get more than one parameter, use [query_pairs] on the Url instead.
sourcepub fn query_param(&self, param: &str) -> Option<Cow<'_, str>>
pub fn query_param(&self, param: &str) -> Option<Cow<'_, str>>
Get the first query parameter given the parameter name.
If you need to get more than one parameter, use [query_pairs] on the Url instead.
sourcepub fn nth_segment(&self, n: usize) -> Option<&str>
pub fn nth_segment(&self, n: usize) -> Option<&str>
Returns the nth segment in the path. Paths that end with a slash have
the slash removed before determining the segments. If the path has
fewer segments than n then this method returns None.
sourcepub fn last_segment(&self) -> Option<&str>
pub fn last_segment(&self) -> Option<&str>
Returns the last segment in the path. Paths that end with a slash have
the slash removed before determining the segments. The root path, /,
will return an empty string.
sourcepub fn segment(&self, name: &str) -> Option<&str>
pub fn segment(&self, name: &str) -> Option<&str>
Get the named parameter from the path, as defined in your router. The
value will be parsed into the type specified by T by calling
value.parse::<T>(). This method returns None if the named
parameter does not exist in the current path.
sourcepub fn parse_segment<T>(&self, name: &str) -> Option<Result<T, T::Err>> where
T: FromStr,
pub fn parse_segment<T>(&self, name: &str) -> Option<Result<T, T::Err>> where
T: FromStr,
Get the named parameter from the path, as defined in your router. The
value will be parsed into the type specified by T by calling
value.parse::<T>(). This method returns None if the named
parameter does not exist in the current path.
Auto Trait Implementations
impl RefUnwindSafe for UseRoute
impl Send for UseRoute
impl Sync for UseRoute
impl Unpin for UseRoute
impl UnwindSafe for UseRoute
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more