[−][src]Struct http_req::uri::Uri
Representation of Uniform Resource Identifier
Example
use http_req::uri::Uri; let uri: Uri = "https://user:info@foo.com:12/bar/baz?query#fragment".parse().unwrap(); assert_eq!(uri.host(), Some("foo.com"));
Methods
impl Uri
[src]
pub fn scheme(&self) -> &str
[src]
Returns scheme of this Uri
.
Example
use http_req::uri::Uri; let uri: Uri = "https://user:info@foo.com:12/bar/baz?query#fragment".parse().unwrap(); assert_eq!(uri.scheme(), "https");
pub fn user_info(&self) -> Option<&str>
[src]
Returns information about the user included in this Uri
.
Example
use http_req::uri::Uri; let uri: Uri = "https://user:info@foo.com:12/bar/baz?query#fragment".parse().unwrap(); assert_eq!(uri.user_info(), Some("user:info"));
pub fn host(&self) -> Option<&str>
[src]
Returns host of this Uri
.
Example
use http_req::uri::Uri; let uri: Uri = "https://user:info@foo.com:12/bar/baz?query#fragment".parse().unwrap(); assert_eq!(uri.host(), Some("foo.com"));
pub fn host_header(&self) -> Option<String>
[src]
Returns host of this Uri
to use in a header.
Example
use http_req::uri::Uri; let uri: Uri = "https://user:info@foo.com:12/bar/baz?query#fragment".parse().unwrap(); assert_eq!(uri.host_header(), Some("foo.com:12".to_string()));
pub fn port(&self) -> Option<u16>
[src]
Returns port of this Uri
Example
use http_req::uri::Uri; let uri: Uri = "https://user:info@foo.com:12/bar/baz?query#fragment".parse().unwrap(); assert_eq!(uri.port(), Some(12));
pub fn corr_port(&self) -> u16
[src]
Returns port corresponding to this Uri
.
Returns default port if it hasn't been set in the uri.
Example
use http_req::uri::Uri; let uri: Uri = "https://user:info@foo.com:12/bar/baz?query#fragment".parse().unwrap(); assert_eq!(uri.corr_port(), 12);
pub fn path(&self) -> Option<&str>
[src]
Returns path of this Uri
.
Example
use http_req::uri::Uri; let uri: Uri = "https://user:info@foo.com:12/bar/baz?query#fragment".parse().unwrap(); assert_eq!(uri.path(), Some("/bar/baz"));
pub fn query(&self) -> Option<&str>
[src]
Returns query of this Uri
.
Example
use http_req::uri::Uri; let uri: Uri = "https://user:info@foo.com:12/bar/baz?query#fragment".parse().unwrap(); assert_eq!(uri.query(), Some("query"));
pub fn fragment(&self) -> Option<&str>
[src]
Returns fragment of this Uri
.
Example
use http_req::uri::Uri; let uri: Uri = "https://user:info@foo.com:12/bar/baz?query#fragment".parse().unwrap(); assert_eq!(uri.fragment(), Some("fragment"));
pub fn resource(&self) -> &str
[src]
Returns resource Uri
points to.
Example
use http_req::uri::Uri; let uri: Uri = "https://user:info@foo.com:12/bar/baz?query#fragment".parse().unwrap(); assert_eq!(uri.resource(), "/bar/baz?query#fragment");
Trait Implementations
impl Clone for Uri
[src]
impl Debug for Uri
[src]
impl Display for Uri
[src]
impl FromStr for Uri
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl PartialEq<Uri> for Uri
[src]
impl StructuralPartialEq for Uri
[src]
Auto Trait Implementations
impl RefUnwindSafe for Uri
impl Send for Uri
impl Sync for Uri
impl Unpin for Uri
impl UnwindSafe for Uri
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,
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
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>,