pub struct Url<'a> {
pub path: Vec<&'a str>,
pub search_params: HashMap<&'a str, &'a str>,
}
Expand description
A parsed URL.
Fields§
§path: Vec<&'a str>
Original path, divided by /
search_params: HashMap<&'a str, &'a str>
Search parameters, specified using ?key=value
in the URL.
Implementations§
source§impl<'a> Url<'a>
impl<'a> Url<'a>
sourcepub fn new(path: Vec<&'a str>, search_params: HashMap<&'a str, &'a str>) -> Self
pub fn new(path: Vec<&'a str>, search_params: HashMap<&'a str, &'a str>) -> Self
Creates directly a URL.
Use Url::from
to parse a string.
sourcepub fn at(&self, i: usize) -> Option<&'a str>
pub fn at(&self, i: usize) -> Option<&'a str>
Returns the i
element of the path.
If the element does not exist, returns None
.
sourcepub fn search_param(&self, key: &'a str) -> Option<&'a str>
pub fn search_param(&self, key: &'a str) -> Option<&'a str>
Gets a copy of a search parameter.
sourcepub fn has_search_param(&self, key: &'a str) -> bool
pub fn has_search_param(&self, key: &'a str) -> bool
Checks if a search parameter exists.
Trait Implementations§
source§impl<'a> PartialEq for Url<'a>
impl<'a> PartialEq for Url<'a>
impl<'a> Eq for Url<'a>
impl<'a> StructuralEq for Url<'a>
impl<'a> StructuralPartialEq for Url<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Url<'a>
impl<'a> Send for Url<'a>
impl<'a> Sync for Url<'a>
impl<'a> Unpin for Url<'a>
impl<'a> UnwindSafe for Url<'a>
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