Struct actix_http::http::uri::PathAndQuery [−][src]
pub struct PathAndQuery { /* fields omitted */ }
Expand description
Represents the path component of a URI
Implementations
Convert a PathAndQuery
from 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
let v = PathAndQuery::from_static("/hello?world");
assert_eq!(v.path(), "/hello");
assert_eq!(v.query(), Some("world"));
Attempt to convert a Bytes
buffer to a PathAndQuery
.
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.
Returns the path component
The path component is case sensitive.
abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1
|--------|
|
path
If the URI is *
then the path component is equal to *
.
Examples
let path_and_query: PathAndQuery = "/hello/world".parse().unwrap();
assert_eq!(path_and_query.path(), "/hello/world");
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
|-------------------|
|
query
Examples
With a query string component
let path_and_query: PathAndQuery = "/hello/world?key=value&foo=bar".parse().unwrap();
assert_eq!(path_and_query.query(), Some("key=value&foo=bar"));
Without a query string component
let path_and_query: PathAndQuery = "/hello/world".parse().unwrap();
assert!(path_and_query.query().is_none());
Returns the path and query as a string component.
Examples
With a query string component
let path_and_query: PathAndQuery = "/hello/world?key=value&foo=bar".parse().unwrap();
assert_eq!(path_and_query.as_str(), "/hello/world?key=value&foo=bar");
Without a query string component
let path_and_query: PathAndQuery = "/hello/world".parse().unwrap();
assert_eq!(path_and_query.as_str(), "/hello/world");
Trait Implementations
type Err = InvalidUri
type Err = InvalidUri
The associated error which can be returned from parsing.
Parses a string s
to return a value of this type. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
type Error = InvalidUri
type Error = InvalidUri
The type returned in the event of a conversion error.
pub fn try_from(
s: &String
) -> Result<PathAndQuery, <PathAndQuery as TryFrom<&'_ String>>::Error>
pub fn try_from(
s: &String
) -> Result<PathAndQuery, <PathAndQuery as TryFrom<&'_ String>>::Error>
Performs the conversion.
type Error = InvalidUri
type Error = InvalidUri
The type returned in the event of a conversion error.
type Error = InvalidUri
type Error = InvalidUri
The type returned in the event of a conversion error.
pub fn try_from(
s: &'a str
) -> Result<PathAndQuery, <PathAndQuery as TryFrom<&'a str>>::Error>
pub fn try_from(
s: &'a str
) -> Result<PathAndQuery, <PathAndQuery as TryFrom<&'a str>>::Error>
Performs the conversion.
type Error = InvalidUri
type Error = InvalidUri
The type returned in the event of a conversion error.
Performs the conversion.
type Error = InvalidUri
type Error = InvalidUri
The type returned in the event of a conversion error.
Auto Trait Implementations
impl RefUnwindSafe for PathAndQuery
impl Send for PathAndQuery
impl Sync for PathAndQuery
impl Unpin for PathAndQuery
impl UnwindSafe for PathAndQuery
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more