Skip to main content

DomainRef

Struct DomainRef 

Source
pub struct DomainRef<'a> { /* private fields */ }
Expand description

A Domain reference.

Implementations§

Source§

impl<'a> DomainRef<'a>

Special Domains

Source

pub const LOCALHOST: Self

The localhost domain.

Source

pub const EXAMPLE: Self

The example.com domain.

Source§

impl<'a> DomainRef<'a>

Construction

Source

pub unsafe fn new_unchecked(name: &'a str) -> Self

Creates a new DomainRef.

§Safety

The name must be valid and lowercase.

Source§

impl<'a> DomainRef<'a>

Properties

Source

pub const fn name(self) -> &'a str

Gets the name.

Source§

impl<'a> DomainRef<'a>

Labels

Source

pub const fn labels(self) -> Labels<'a>

Gets the labels.

Source§

impl<'a> DomainRef<'a>

Conversions

Source

pub fn to_domain(self) -> Domain

Converts the domain reference to a domain.

Source

pub fn to_endpoint(self, port: u16) -> Endpoint

Converts the domain reference to an endpoint with the port.

Source

pub const fn to_endpoint_ref(self, port: u16) -> EndpointRef<'a>

Converts the domain reference to an endpoint reference with the port.

Source

pub fn to_host(self) -> Host

Converts the domain reference to a host.

Source

pub const fn to_host_ref(self) -> HostRef<'a>

Converts the domain reference to a host reference.

Source§

impl<'a> DomainRef<'a>

Parse

Source

pub fn parse_text(text: &'a [u8]) -> Result<Self, ParseError>

Dot-separated labels of ASCII letters, digits, & dashes. (see Domain::is_valid_name) The name must already be in lowercase. Use Domain to parse mixed-case input.

Source§

impl<'a> DomainRef<'a>

International Domain Names

Source

pub fn to_unicode(self) -> Result<String, ParseError>

Available on crate feature idna only.

Converts the domain name to its Unicode representation.

Returns an error if a label contains invalid punycode. (example: xn--a.example)

Trait Implementations§

Source§

impl<'a> AsRef<str> for DomainRef<'a>

Source§

fn as_ref(&self) -> &str

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

impl<'a> Borrow<str> for DomainRef<'a>

Source§

fn borrow(&self) -> &str

Immutably borrows from an owned value. Read more
Source§

impl<'a> Clone for DomainRef<'a>

Source§

fn clone(&self) -> DomainRef<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for DomainRef<'a>

Source§

impl<'a> Debug for DomainRef<'a>

Source§

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

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

impl<'de: 'a, 'a> Deserialize<'de> for DomainRef<'a>

Available on crate feature serde only.
Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

The string is borrowed from the input, so domain names must be lowercase and must not contain escape sequences. Use Domain to deserialize mixed-case or escaped input.

Source§

impl<'a> Display for DomainRef<'a>

Source§

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

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

impl<'a> Eq for DomainRef<'a>

Source§

impl<'a> From<&'a Domain> for DomainRef<'a>

Source§

fn from(domain: &'a Domain) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<DomainRef<'a>> for Domain

Source§

fn from(domain: DomainRef<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<DomainRef<'a>> for Host

Source§

fn from(domain: DomainRef<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<DomainRef<'a>> for HostRef<'a>

Source§

fn from(domain: DomainRef<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> Hash for DomainRef<'a>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> Ord for DomainRef<'a>

Source§

fn cmp(&self, other: &DomainRef<'a>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<'a> PartialEq for DomainRef<'a>

Source§

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

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

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

Inequality operator !=. Read more
Source§

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

Source§

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

Compares the name exactly; domain names are lowercase, so mixed-case strings are never equal.

1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<'a> PartialEq<Domain> for DomainRef<'a>

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl<'a> PartialEq<DomainRef<'a>> for Domain

Source§

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

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

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

Inequality operator !=. Read more
Source§

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

Source§

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

Compares the name exactly; domain names are lowercase, so mixed-case strings are never equal.

1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<'a> PartialEq<DomainRef<'a>> for String

Source§

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

Compares the name exactly; domain names are lowercase, so mixed-case strings are never equal.

1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<'a> PartialEq<String> for DomainRef<'a>

Source§

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

Compares the name exactly; domain names are lowercase, so mixed-case strings are never equal.

1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<'a> PartialOrd for DomainRef<'a>

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a> Serialize for DomainRef<'a>

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> StructuralPartialEq for DomainRef<'a>

Source§

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

Source§

fn try_from(text: &'a str) -> Result<Self, Self::Error>

Dot-separated labels of ASCII letters, digits, & dashes. (see Domain::is_valid_name) The name must already be in lowercase. Use Domain to parse mixed-case input.

Source§

type Error = ParseError

The type returned in the event of a conversion error.

Auto Trait Implementations§

§

impl<'a> Freeze for DomainRef<'a>

§

impl<'a> RefUnwindSafe for DomainRef<'a>

§

impl<'a> Send for DomainRef<'a>

§

impl<'a> Sync for DomainRef<'a>

§

impl<'a> Unpin for DomainRef<'a>

§

impl<'a> UnsafeUnpin for DomainRef<'a>

§

impl<'a> UnwindSafe for DomainRef<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.