Struct PathAndQuery
pub struct PathAndQuery { /* private fields */ }
Represents the path component of a URI
Implementations
impl PathAndQuery
const fn from_static(src: &'static str) -> SelfConvert a
PathAndQueryfrom a static string.This function will not perform any copying, however the string is checked to ensure that it is valid.
Panics
This function panics if the argument is an invalid path and query.
Examples
# use *; let v = from_static; assert_eq!; assert_eq!;Attempt to convert a
Bytesbuffer to aPathAndQuery.This will try to prevent a copy if the type passed is the type used internally, and will copy the data if it is not.
fn path(&self) -> &strReturns the path component
The path component is case sensitive.
abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1 |--------| | pathIf the URI is
*then the path component is equal to*.Examples
# use *; let path_and_query: PathAndQuery = "/hello/world".parse.unwrap; assert_eq!;fn query(&self) -> Option<&str>Returns the query string component
The query component contains non-hierarchical data that, along with data in the path component, serves to identify a resource within the scope of the URI's scheme and naming authority (if any). The query component is indicated by the first question mark ("?") character and terminated by a number sign ("#") character or by the end of the URI.
abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1 |-------------------| | queryExamples
With a query string component
# use *; let path_and_query: PathAndQuery = "/hello/world?key=value&foo=bar".parse.unwrap; assert_eq!;Without a query string component
# use *; let path_and_query: PathAndQuery = "/hello/world".parse.unwrap; assert!;fn as_str(&self) -> &strReturns the path and query as a string component.
Examples
With a query string component
# use *; let path_and_query: PathAndQuery = "/hello/world?key=value&foo=bar".parse.unwrap; assert_eq!;Without a query string component
# use *; let path_and_query: PathAndQuery = "/hello/world".parse.unwrap; assert_eq!;
Trait Implementations
impl Clone for PathAndQuery
fn clone(&self) -> PathAndQuery
impl Debug for PathAndQuery
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Display for PathAndQuery
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result
impl Eq for PathAndQuery
impl FromStr for PathAndQuery
type Err = InvalidUri;fn from_str(s: &str) -> Result<Self, InvalidUri>
impl Hash for PathAndQuery
fn hash<H: Hasher>(&self, state: &mut H)
impl PartialEq for PathAndQuery
fn eq(&self, other: &PathAndQuery) -> bool
impl PartialEq<&str> for PathAndQuery
fn eq(&self, other: &&str) -> bool
impl PartialEq<String> for PathAndQuery
fn eq(&self, other: &String) -> bool
impl PartialEq<str> for PathAndQuery
fn eq(&self, other: &str) -> bool
impl PartialOrd for PathAndQuery
fn partial_cmp(&self, other: &PathAndQuery) -> Option<Ordering>
impl PartialOrd<&str> for PathAndQuery
fn partial_cmp(&self, other: &&str) -> Option<Ordering>
impl PartialOrd<String> for PathAndQuery
fn partial_cmp(&self, other: &String) -> Option<Ordering>
impl PartialOrd<str> for PathAndQuery
fn partial_cmp(&self, other: &str) -> Option<Ordering>
impl TryFrom<&String> for PathAndQuery
type Error = InvalidUri;fn try_from(s: &String) -> Result<Self, Self::Error>
impl TryFrom<&[u8]> for PathAndQuery
type Error = InvalidUri;fn try_from(s: &[u8]) -> Result<Self, Self::Error>
impl TryFrom<&str> for PathAndQuery
type Error = InvalidUri;fn try_from(s: &str) -> Result<Self, Self::Error>
impl TryFrom<String> for PathAndQuery
type Error = InvalidUri;fn try_from(s: String) -> Result<Self, Self::Error>
impl TryFrom<Vec<u8>> for PathAndQuery
type Error = InvalidUri;fn try_from(vec: Vec<u8>) -> Result<Self, Self::Error>
Auto Trait Implementations
impl !Freeze for PathAndQuery
impl RefUnwindSafe for PathAndQuery
impl Send for PathAndQuery
impl Sync for PathAndQuery
impl Unpin for PathAndQuery
impl UnsafeUnpin for PathAndQuery
impl UnwindSafe for PathAndQuery
Blanket Implementations
impl<T> Any for PathAndQuery
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for PathAndQuery
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for PathAndQuery
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for PathAndQuery
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for PathAndQuery
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for PathAndQuery
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> ToString for PathAndQuery
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for PathAndQuery
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for PathAndQuery
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for PathAndQuery
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>