Skip to main content

Target

Struct Target 

Source
pub struct Target { /* private fields */ }
Expand description

An owned URI target with one admitted authority and origin form.

Component offsets retain the parser’s bounds and grammar proofs. Self::try_clone copies the owned bytes; targets never share reference-counted storage.

Implementations§

Source§

impl Target

Source

pub fn parse(value: &str) -> Result<Self, Error>

Source

pub fn new(raw: &str, origin: Origin<'_>) -> Result<Self, Error>

Source

pub fn from_host( host: &str, port: Option<NonZero<u16>>, origin: Origin<'_>, ) -> Result<Self, Error>

Source

pub fn scheme_str(&self) -> Option<&str>

Source

pub fn try_clone(&self) -> Result<Self, Exhausted>

Copies the admitted bytes and offsets without parsing again.

Source

pub fn authority(&self) -> &str

Source

pub fn host_raw(&self) -> &str

The host spelling in the authority, including IPv6 brackets.

Source

pub fn host(&self) -> &str

Source

pub fn path(&self) -> &str

Source

pub fn path_query(&self) -> &str

Source

pub fn query(&self) -> Option<&str>

Source

pub fn retarget(self, raw: &str) -> Result<Self, Error>

Source

pub fn with_origin(&self, origin: Origin<'_>) -> Result<Self, Error>

Source

pub fn normalize(self) -> Result<Self, Error>

Removes dot segments while retaining the admitted component syntax.

Source

pub fn parts(&self) -> Authority<'_>

Borrows the authority components proved when this target was admitted.

Trait Implementations§

Source§

impl AsRef<str> for Target

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for Target

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Target

Source§

impl<'a> From<&'a Target> for Origin<'a>

Source§

fn from(target: &'a Target) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Target

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(value: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for Target

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Convert<T> for T

Source§

fn into(self) -> T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.