Struct iref::iri::Host

source ·
pub struct Host(/* private fields */);
Expand description

IRI authority host.

Implementations§

source§

impl Host

source

pub fn new<T: ?Sized + AsRef<str>>(input: &T) -> Result<&Self, InvalidHost<&T>>

Creates a new IRI host by parsing the input value

source

pub const unsafe fn new_unchecked(input: &str) -> &Self

Creates a new IRI host from the input value without validation.

§Safety

The input data must be a valid IRI host.

source

pub fn validate(input: impl Iterator<Item = char>) -> bool

Checks that the input iterator produces a valid IRI host

source§

impl Host

source

pub const EMPTY: &'static Self = _

source§

impl Host

source

pub fn as_str(&self) -> &str

source

pub fn as_bytes(&self) -> &[u8]

source§

impl Host

source

pub fn as_pct_str(&self) -> &PctStr

Returns the host as a percent-encoded string slice.

Methods from Deref<Target = PctStr>§

source

pub fn len(&self) -> usize

Length of the decoded string (character count).

Computed in linear time. This is different from the byte length, which can be retrieved using value.as_bytes().len().

source

pub fn is_empty(&self) -> bool

Checks if the string is empty.

source

pub fn as_bytes(&self) -> &[u8]

Returns the underlying percent-encoding bytes.

source

pub fn as_str(&self) -> &str

Get the underlying percent-encoded string slice.

source

pub fn chars(&self) -> Chars<'_>

Iterate over the encoded characters of the string.

source

pub fn bytes(&self) -> Bytes<'_>

Iterate over the encoded bytes of the string.

source

pub fn decode(&self) -> String

Decoding.

Return the string with the percent-encoded characters decoded.

Trait Implementations§

source§

impl AsRef<[u8]> for Host

source§

fn as_ref(&self) -> &[u8]

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

impl AsRef<Host> for Host

source§

fn as_ref(&self) -> &Host

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

impl AsRef<Host> for HostBuf

source§

fn as_ref(&self) -> &Host

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

impl AsRef<str> for Host

source§

fn as_ref(&self) -> &str

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

impl Borrow<[u8]> for Host

source§

fn borrow(&self) -> &[u8]

Immutably borrows from an owned value. Read more
source§

impl Borrow<Host> for HostBuf

source§

fn borrow(&self) -> &Host

Immutably borrows from an owned value. Read more
source§

impl Borrow<str> for Host

source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
source§

impl Debug for Host

source§

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

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

impl Deref for Host

§

type Target = PctStr

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl Display for Host

source§

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

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

impl<'a> From<&'a Host> for &'a str

source§

fn from(value: &'a Host) -> &'a str

Converts to this type from the input type.
source§

impl Hash for Host

source§

fn hash<H: Hasher>(&self, hasher: &mut H)

Feeds this value into the given Hasher. Read more
source§

impl Ord for Host

source§

fn cmp(&self, other: &Host) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl<'a> PartialEq<&'a Host> for HostBuf

source§

fn eq(&self, other: &&'a Host) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialEq<&'a str> for Host

source§

fn eq(&self, other: &&'a str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Host> for HostBuf

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for Host

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> PartialOrd<&'a Host> for HostBuf

source§

fn partial_cmp(&self, other: &&'a Host) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<Host> for HostBuf

source§

fn partial_cmp(&self, other: &Host) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd for Host

source§

fn partial_cmp(&self, other: &Host) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl ToOwned for Host

§

type Owned = HostBuf

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> HostBuf

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<'a> TryFrom<&'a str> for &'a Host

§

type Error = InvalidHost<&'a str>

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

fn try_from(input: &'a str) -> Result<&'a Host, InvalidHost<&'a str>>

Performs the conversion.
source§

impl Eq for Host

Auto Trait Implementations§

§

impl RefUnwindSafe for Host

§

impl Send for Host

§

impl !Sized for Host

§

impl Sync for Host

§

impl Unpin for Host

§

impl UnwindSafe for Host

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more