pub struct HttpUri<'uri> { /* private fields */ }Expand description
A type representing valid http uri
Implementations
sourceimpl<'uri> HttpUri<'uri>
impl<'uri> HttpUri<'uri>
sourcepub fn into_owned(self) -> HttpUri<'static>
pub fn into_owned(self) -> HttpUri<'static>
make it’s lifetime static
sourcepub fn normalize_inner_uri(&mut self)
pub fn normalize_inner_uri(&mut self)
Normalizes inner uri per rfc
sourcepub fn has_explicit_default_port(&self) -> bool
pub fn has_explicit_default_port(&self) -> bool
Checks If explicit port of http uri is same as corresponding default port of it’s http(s) scheme,
sourcepub fn remove_explicit_default_port(&mut self)
pub fn remove_explicit_default_port(&mut self)
Removes explicit port, if explicit port of http uri is same as corresponding default port of it’s http(s) scheme, Otherwise, this method is no op.
sourcepub fn remove_non_trailing_empty_segments(&mut self)
pub fn remove_non_trailing_empty_segments(&mut self)
Removes non-trailing empty segments.
Methods from Deref<Target = URI<'uri>>
pub fn as_uri_reference(&self) -> &URIReference<'uri>
Returns the authority, if present, of the URI.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://example.com:80/my/path").unwrap();
assert_eq!(uri.authority().unwrap().to_string(), "example.com:80");sourcepub fn can_be_a_base(&self) -> bool
pub fn can_be_a_base(&self) -> bool
Returns whether the URI can act as a base URI.
A URI can be a base if it is absolute (i.e. it has no fragment component).
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://example.com/my/path").unwrap();
assert!(uri.can_be_a_base());
let uri = URI::try_from("ftp://127.0.0.1#fragment").unwrap();
assert!(!uri.can_be_a_base());sourcepub fn fragment(&self) -> Option<&Fragment<'uri>>
pub fn fragment(&self) -> Option<&Fragment<'uri>>
Returns the fragment, if present, of the URI.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://example.com#fragment").unwrap();
assert_eq!(uri.fragment().unwrap(), "fragment");Returns whether the URI has an authority component.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://example.com").unwrap();
assert!(uri.has_authority());
let uri = URI::try_from("urn:test").unwrap();
assert!(!uri.has_authority());sourcepub fn has_fragment(&self) -> bool
pub fn has_fragment(&self) -> bool
Returns whether the URI has a fragment component.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://example.com#test").unwrap();
assert!(uri.has_fragment());
let uri = URI::try_from("http://example.com").unwrap();
assert!(!uri.has_fragment());sourcepub fn has_password(&self) -> bool
pub fn has_password(&self) -> bool
Returns whether the URI has a password component.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://user:pass@127.0.0.1").unwrap();
assert!(uri.has_password());
let uri = URI::try_from("http://user@127.0.0.1").unwrap();
assert!(!uri.has_password());sourcepub fn has_port(&self) -> bool
pub fn has_port(&self) -> bool
Returns whether the URI has a port.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://127.0.0.1:8080").unwrap();
assert!(uri.has_port());
let uri = URI::try_from("http://127.0.0.1").unwrap();
assert!(!uri.has_port());sourcepub fn has_query(&self) -> bool
pub fn has_query(&self) -> bool
Returns whether the URI has a query component.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://example.com/my/path?my=query").unwrap();
assert!(uri.has_query());
let uri = URI::try_from("http://example.com/my/path").unwrap();
assert!(!uri.has_query());sourcepub fn has_username(&self) -> bool
pub fn has_username(&self) -> bool
Returns whether the URI has a username component.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://username@example.com").unwrap();
assert!(uri.has_username());
let uri = URI::try_from("http://example.com").unwrap();
assert!(!uri.has_username());sourcepub fn host(&self) -> Option<&Host<'uri>>
pub fn host(&self) -> Option<&Host<'uri>>
Returns the host, if present, of the URI.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://username@example.com").unwrap();
assert_eq!(uri.host().unwrap().to_string(), "example.com");sourcepub fn is_normalized(&self) -> bool
pub fn is_normalized(&self) -> bool
Returns whether the URI is normalized.
A normalized URI will have all of its components normalized.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://example.com/?a=b").unwrap();
assert!(uri.is_normalized());
let mut uri = URI::try_from("http://EXAMPLE.com/?a=b").unwrap();
assert!(!uri.is_normalized());
uri.normalize();
assert!(uri.is_normalized());sourcepub fn path(&self) -> &Path<'uri>
pub fn path(&self) -> &Path<'uri>
Returns the path of the URI.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://127.0.0.1/my/path").unwrap();
assert_eq!(uri.path(), "/my/path");sourcepub fn password(&self) -> Option<&Password<'uri>>
pub fn password(&self) -> Option<&Password<'uri>>
Returns the password, if present, of the URI.
Usage of a password in URIs is deprecated.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://user:pass@example.com").unwrap();
assert_eq!(uri.password().unwrap(), "pass");sourcepub fn port(&self) -> Option<u16>
pub fn port(&self) -> Option<u16>
Returns the port, if present, of the URI.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://example.com:8080/").unwrap();
assert_eq!(uri.port().unwrap(), 8080);sourcepub fn query(&self) -> Option<&Query<'uri>>
pub fn query(&self) -> Option<&Query<'uri>>
Returns the query, if present, of the URI.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://127.0.0.1?my=query").unwrap();
assert_eq!(uri.query().unwrap(), "my=query");sourcepub fn resolve(&self, reference: &'uri URIReference<'uri>) -> URI<'uri>
pub fn resolve(&self, reference: &'uri URIReference<'uri>) -> URI<'uri>
Creates a new URI which is created by resolving the given reference against this URI.
The algorithm used for resolving the reference is described in [RFC3986, Section 5.2.2].
sourcepub fn scheme(&self) -> &Scheme<'uri>
pub fn scheme(&self) -> &Scheme<'uri>
Returns the scheme of the URI.
Examples
use std::convert::TryFrom;
use uriparse::URI;
let uri = URI::try_from("http://127.0.0.1/").unwrap();
assert_eq!(uri.scheme(), "http");sourcepub fn to_borrowed(&self) -> URI<'_>
pub fn to_borrowed(&self) -> URI<'_>
Returns a new URI which is identical but has a lifetime tied to this URI.
This function will perform a memory allocation.
Trait Implementations
sourceimpl<'uri, TI> Borrow<HttpUri<'uri>> for NormalHttpUri<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Borrow<HttpUri<'uri>> for NormalHttpUri<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'uri, TI> Borrow<HttpUri<'uri>> for HttpUriWithFragment<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Borrow<HttpUri<'uri>> for HttpUriWithFragment<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'uri, TI> Borrow<HttpUri<'uri>> for HttpUriWithQuery<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Borrow<HttpUri<'uri>> for HttpUriWithQuery<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'uri, TI> Borrow<HttpUri<'uri>> for HttpUriWithTslash<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Borrow<HttpUri<'uri>> for HttpUriWithTslash<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'uri, TI> Borrow<HttpUri<'uri>> for HttpUriSansFragment<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Borrow<HttpUri<'uri>> for HttpUriSansFragment<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'uri, TI> Borrow<HttpUri<'uri>> for HttpUriSansQuery<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Borrow<HttpUri<'uri>> for HttpUriSansQuery<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'uri, TI> Borrow<HttpUri<'uri>> for HttpUriSansTslash<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Borrow<HttpUri<'uri>> for HttpUriSansTslash<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'uri, TI> Into<HttpUri<'uri>> for NormalHttpUri<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Into<HttpUri<'uri>> for NormalHttpUri<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'uri, TI> Into<HttpUri<'uri>> for HttpUriWithFragment<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Into<HttpUri<'uri>> for HttpUriWithFragment<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'uri, TI> Into<HttpUri<'uri>> for HttpUriWithQuery<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Into<HttpUri<'uri>> for HttpUriWithQuery<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'uri, TI> Into<HttpUri<'uri>> for HttpUriWithTslash<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Into<HttpUri<'uri>> for HttpUriWithTslash<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'uri, TI> Into<HttpUri<'uri>> for HttpUriSansFragment<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Into<HttpUri<'uri>> for HttpUriSansFragment<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'uri, TI> Into<HttpUri<'uri>> for HttpUriSansQuery<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Into<HttpUri<'uri>> for HttpUriSansQuery<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'uri, TI> Into<HttpUri<'uri>> for HttpUriSansTslash<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
impl<'uri, TI> Into<HttpUri<'uri>> for HttpUriSansTslash<'uri, TI> where
TI: TypeInvariant<HttpUri<'uri>> + Clone + PartialEq,
sourceimpl<'a, 'uri, HUI> TryFrom<Cow<'a, HUI>> for HttpUri<'uri> where
HUI: TypeInvariant<HttpUri<'uri>> + Clone,
impl<'a, 'uri, HUI> TryFrom<Cow<'a, HUI>> for HttpUri<'uri> where
HUI: TypeInvariant<HttpUri<'uri>> + Clone,
Implementation in parity with remaining other invariants
sourceimpl<'uri> TryFrom<HttpUri<'uri>> for AbsoluteNormalizedHttpUri<'uri>
impl<'uri> TryFrom<HttpUri<'uri>> for AbsoluteNormalizedHttpUri<'uri>
sourceimpl<'uri> TryFrom<HttpUri<'uri>> for HierarchicalNormalizedHttpUri<'uri>
impl<'uri> TryFrom<HttpUri<'uri>> for HierarchicalNormalizedHttpUri<'uri>
sourceimpl<'uri> TryFrom<HttpUri<'uri>> for HierarchicalNormalizedHttpUriWithTslash<'uri>
impl<'uri> TryFrom<HttpUri<'uri>> for HierarchicalNormalizedHttpUriWithTslash<'uri>
sourceimpl<'uri> TryFrom<HttpUri<'uri>> for NormalizedHttpUri<'uri>
impl<'uri> TryFrom<HttpUri<'uri>> for NormalizedHttpUri<'uri>
impl<'uri> HttpUriNormalizationOrthogonal<'uri> for HttpUri<'uri>
Auto Trait Implementations
impl<'uri> RefUnwindSafe for HttpUri<'uri>
impl<'uri> Send for HttpUri<'uri>
impl<'uri> Sync for HttpUri<'uri>
impl<'uri> Unpin for HttpUri<'uri>
impl<'uri> UnwindSafe for HttpUri<'uri>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more