pub struct Authority<'a> { /* private fields */ }
Expand description
Authority of Uri
§Example
use http_req::uri::Authority;
use std::convert::TryFrom;
let auth: Authority = Authority::try_from("user:info@foo.com:443").unwrap();
assert_eq!(auth.host(), "foo.com");
Implementations§
source§impl<'a> Authority<'a>
impl<'a> Authority<'a>
sourcepub fn username(&self) -> Option<&'a str>
pub fn username(&self) -> Option<&'a str>
Returns username of this Authority
§Example
use http_req::uri::Authority;
use std::convert::TryFrom;
let auth: Authority = Authority::try_from("user:info@foo.com:443").unwrap();
assert_eq!(auth.username(), Some("user"));
sourcepub fn password(&self) -> Option<&str>
pub fn password(&self) -> Option<&str>
Returns password of this Authority
§Example
use http_req::uri::Authority;
use std::convert::TryFrom;
let auth: Authority = Authority::try_from("user:info@foo.com:443").unwrap();
assert_eq!(auth.password(), Some("info"));
sourcepub fn user_info(&self) -> Option<&str>
pub fn user_info(&self) -> Option<&str>
Returns information about the user
§Example
use http_req::uri::Authority;
use std::convert::TryFrom;
let auth: Authority = Authority::try_from("user:info@foo.com:443").unwrap();
assert_eq!(auth.user_info(), Some("user:info"));
Trait Implementations§
source§impl<'a> PartialEq for Authority<'a>
impl<'a> PartialEq for Authority<'a>
impl<'a> StructuralPartialEq for Authority<'a>
Auto Trait Implementations§
impl<'a> Freeze for Authority<'a>
impl<'a> RefUnwindSafe for Authority<'a>
impl<'a> Send for Authority<'a>
impl<'a> Sync for Authority<'a>
impl<'a> Unpin for Authority<'a>
impl<'a> UnwindSafe for Authority<'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