Struct domain::bits::name::DNameSlice[][src]

pub struct DNameSlice { /* fields omitted */ }

A slice of a domain name.

The slice is guaranteed to contain a correctly encoded domain name. The name may be relative or absolute but cannot support name compression.

Operations are available for iterating over the labels of the name and breaking the name up into parts along the lines of label boundaries.

This is an unsized type. You will have to use it with some kind of pointer, such as a reference or box. The sibling type owning the name outright is DNameBuf. The two can be used together through the AsRef<DNameSlice> trait or via a Cow<DNameSlice>.

Methods

impl DNameSlice
[src]

Creates a domain name slice from a bytes slice without checking.

This is only safe if the input slice follows the encoding rules for a domain name and does not contain compressed labels.

Creates a domain name from a bytes slice if it contains a valid name.

The bytes slice must be exactly one correctly encoded, uncompressed domain name. If it isn’t or if it contains trailing data, the function returns None.

As this function traverses the slice to check that it is correctly encoded, it may take a bit of time.

Creates a domain name slice for the root domain name.

Creates an empty domain name slice.

Returns a reference to the underlying bytes slice.

Converts the domain name slice to an owned domain name.

impl DNameSlice
[src]

Checks whether the domain name is absolute.

A domain name is absolute if it ends with an empty normal label (the root label).

Checks whether the domain name is relative, ie., not absolute.

impl DNameSlice
[src]

Important traits for NameLabels<'a>

Produces an iterator over the labels in the name.

Important traits for NameLabelettes<'a>

Produces an iterator over the labelettes in the name.

Returns the number of labels in self.

Checks whether the domain name is empty.

Returns the first label or None if the name is empty.

Returns the last label or None if the name is empty.

Returns the number of dots if this is a relative name.

Returns None if this is an absolute name.

impl DNameSlice
[src]

Returns the first label and the remaining domain name.

Returns None only if the name is empty (which is different from a name containing only the root label).

Returns the domain name without its leftmost label.

Returns None for an empty domain name and a domain name consisting of only the root label. Returns an empty domain name for a single label relative domain name.

Returns a domain name slice relative to base.

This fails if base isn’t a suffix of self.

Determines whether base is a prefix of self.

Determines whether base is a suffix of self.

Creates an owned domain name made absolute if necessary.

If self is already an absolute domain name, nothing happens.

Trait Implementations

impl<'a> DName for &'a DNameSlice
[src]

Converts the name into an uncompressed name. Read more

Important traits for NameLabels<'a>

Returns an iterator over the labels of the domain name.

Important traits for NameLabelettes<'a>

Returns an iterator over the labelettes of the domain name. Read more

Appends the name to the end of a composition.

Appends the name to the end of a composition using name compression.

impl<'a> From<&'a Label> for &'a DNameSlice
[src]

Performs the conversion.

impl AsRef<DNameSlice> for DNameSlice
[src]

Performs the conversion.

impl ToOwned for DNameSlice
[src]

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<'a> IntoIterator for &'a DNameSlice
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl PartialEq for DNameSlice
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<N: DName> PartialEq<N> for DNameSlice
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialEq<str> for DNameSlice
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for DNameSlice
[src]

impl PartialOrd for DNameSlice
[src]

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

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

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

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

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

impl<N: DName> PartialOrd<N> for DNameSlice
[src]

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

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

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

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

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

impl Ord for DNameSlice
[src]

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

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl Hash for DNameSlice
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl Display for DNameSlice
[src]

Formats the value using the given formatter. Read more

impl Octal for DNameSlice
[src]

Formats the value using the given formatter.

impl LowerHex for DNameSlice
[src]

Formats the value using the given formatter.

impl UpperHex for DNameSlice
[src]

Formats the value using the given formatter.

impl Binary for DNameSlice
[src]

Formats the value using the given formatter.

impl Debug for DNameSlice
[src]

Formats the value using the given formatter. Read more

impl<'a> From<&'a DNameSlice> for DNameBuf
[src]

Performs the conversion.

impl Borrow<DNameSlice> for DNameBuf
[src]

Immutably borrows from an owned value. Read more

impl AsRef<DNameSlice> for DNameBuf
[src]

Performs the conversion.

Auto Trait Implementations

impl Send for DNameSlice

impl Sync for DNameSlice