Struct domain::bits::DNameBuf[][src]

pub struct DNameBuf { /* fields omitted */ }

An owned complete domain name.

A value of this type contains a vector with a correctly encoded, uncompressed domain name. It derefs to DNameSlice in order to make all its methods available for working with domain names.

In addition, it provides a number of methods to add labels or entire names to its end.

DNameBuf values can be created from string via the std::str::FromStr trait. Such strings must be in the usual zonefile encoding.

Methods

impl DNameBuf
[src]

Creates a new empty domain name.

Creates a new empty name with the given amount of space reserved.

Creates an owned domain name using an existing bytes vector.

If the content of the bytes vector does not constitute a correctly encoded uncompressed domain name, the function will fail.

Creates an owned domain name from the labels of the iterator.

Creates an owned domain name by reading it from a scanner.

Returns a new owned domain name consisting only of the root label.

Returns a reference to a slice of the domain name.

Extracts the underlying vector from the name.

impl DNameBuf
[src]

Manipulations

Extends a relative name with a label.

If the name is absolute, nothing happens.

Pushes a normal label to the end of a relative name.

If the name is absolute, nothing happens. If the resulting name would exceed the maximum allowd length of 255 octets, returns an error.

Panics

The method panics if content is longer that 63 bytes.

Pushes a binary label to the end of a relative name.

The binary label will be count bits long and contain the bits from bits. If bits is too short, the label will be filled up with zero bits. If bits is too long, it will be trimmed to the right length.

If the name is absolute, nothing happens. If the resulting name would exceed the maximum allowd length of 255 octets, returns an error.

Panics

The method panics if count is larger than 256.

Pushes an empty binary label of the given length to the domain name.

Upon success the function returns a mutable reference to the bytes slice of the bits of the binary label.

If the name is already absolute, returns Ok(None). If the resulting name would exceed the maximum allowd length of 255 octets, returns an error.

Panics

The method panics if count is larger than 256.

Extends a relative name with a domain name.

If the name is already absolute, nothing will be appended and the name remains unchanged. If by appending the name would exceed the maximum allowed length of 255 octets, an error will be returned and the name remains unchanged, too.

Makes a domain name absolute if it isn’t yet by appending root.

This may fail if the name is already 255 octets long.

Appends the content of an iterator to the end of the name.

Removes the first label.

After this operation, the content of self is self.parent().

Panics

Panics if the name is empty.

Methods from Deref<Target = DNameSlice>

Returns a reference to the underlying bytes slice.

Converts the domain name slice to an owned domain name.

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.

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.

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 Clone for DNameBuf
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Default for DNameBuf
[src]

Returns the "default value" for a type. Read more

impl DName for DNameBuf
[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> DName for &'a DNameBuf
[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 DNameSlice> for DNameBuf
[src]

Performs the conversion.

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

Performs the conversion.

impl FromStr for DNameBuf
[src]

The associated error which can be returned from parsing.

Creates a new domain name from a string.

The string must follow zone file conventions. It must only contain printable ASCII characters and no whitespace. Invidual labels are separated by a dot. A backslash escapes the next character unless that is a 0, 1, or 2, in which case the next three characters are the byte value in decimal representation.

impl Deref for DNameBuf
[src]

The resulting type after dereferencing.

Dereferences the value.

impl Borrow<DNameSlice> for DNameBuf
[src]

Immutably borrows from an owned value. Read more

impl AsRef<DNameSlice> for DNameBuf
[src]

Performs the conversion.

impl<N: DName> PartialEq<N> for DNameBuf
[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 DNameBuf
[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 DNameBuf
[src]

impl<N: DName> PartialOrd<N> for DNameBuf
[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 DNameBuf
[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 DNameBuf
[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 DNameBuf
[src]

Formats the value using the given formatter. Read more

impl Octal for DNameBuf
[src]

Formats the value using the given formatter.

impl LowerHex for DNameBuf
[src]

Formats the value using the given formatter.

impl UpperHex for DNameBuf
[src]

Formats the value using the given formatter.

impl Binary for DNameBuf
[src]

Formats the value using the given formatter.

impl Debug for DNameBuf
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for DNameBuf

impl Sync for DNameBuf