[][src]Struct domain_core::rdata::rfc1035::Null

pub struct Null { /* fields omitted */ }

Null record data.

Null records can contain whatever data. They are experimental and not allowed in master files.

The Null record type is defined in RFC 1035, section 3.3.10.

Methods

impl Null[src]

pub fn new(data: Bytes) -> Self[src]

Creates new, empty owned Null record data.

pub fn data(&self) -> &Bytes[src]

The raw content of the record.

Methods from Deref<Target = Bytes>

pub fn len(&self) -> usize[src]

Returns the number of bytes contained in this Bytes.

Examples

use bytes::Bytes;

let b = Bytes::from(&b"hello"[..]);
assert_eq!(b.len(), 5);

pub fn is_empty(&self) -> bool[src]

Returns true if the Bytes has a length of 0.

Examples

use bytes::Bytes;

let b = Bytes::new();
assert!(b.is_empty());

pub fn slice(&self, begin: usize, end: usize) -> Bytes[src]

Returns a slice of self for the index range [begin..end).

This will increment the reference count for the underlying memory and return a new Bytes handle set to the slice.

This operation is O(1).

Examples

use bytes::Bytes;

let a = Bytes::from(&b"hello world"[..]);
let b = a.slice(2, 5);

assert_eq!(&b[..], b"llo");

Panics

Requires that begin <= end and end <= self.len(), otherwise slicing will panic.

pub fn slice_from(&self, begin: usize) -> Bytes[src]

Returns a slice of self for the index range [begin..self.len()).

This will increment the reference count for the underlying memory and return a new Bytes handle set to the slice.

This operation is O(1) and is equivalent to self.slice(begin, self.len()).

Examples

use bytes::Bytes;

let a = Bytes::from(&b"hello world"[..]);
let b = a.slice_from(6);

assert_eq!(&b[..], b"world");

Panics

Requires that begin <= self.len(), otherwise slicing will panic.

pub fn slice_to(&self, end: usize) -> Bytes[src]

Returns a slice of self for the index range [0..end).

This will increment the reference count for the underlying memory and return a new Bytes handle set to the slice.

This operation is O(1) and is equivalent to self.slice(0, end).

Examples

use bytes::Bytes;

let a = Bytes::from(&b"hello world"[..]);
let b = a.slice_to(5);

assert_eq!(&b[..], b"hello");

Panics

Requires that end <= self.len(), otherwise slicing will panic.

pub fn slice_ref(&self, subset: &[u8]) -> Bytes[src]

Returns a slice of self that is equivalent to the given subset.

When processing a Bytes buffer with other tools, one often gets a &[u8] which is in fact a slice of the Bytes, i.e. a subset of it. This function turns that &[u8] into another Bytes, as if one had called self.slice() with the offsets that correspond to subset.

This operation is O(1).

Examples

use bytes::Bytes;

let bytes = Bytes::from(&b"012345678"[..]);
let as_slice = bytes.as_ref();
let subset = &as_slice[2..6];
let subslice = bytes.slice_ref(&subset);
assert_eq!(&subslice[..], b"2345");

Panics

Requires that the given sub slice is in fact contained within the Bytes buffer; otherwise this function will panic.

Trait Implementations

impl Compose for Null[src]

impl Compress for Null[src]

impl ParseAll for Null[src]

type Err = ShortBuf

The type returned when parsing fails.

impl RtypeRecordData for Null[src]

impl AsRef<Bytes> for Null[src]

impl AsRef<[u8]> for Null[src]

impl From<Bytes> for Null[src]

impl<N> From<Null> for AllRecordData<N>[src]

impl PartialEq<Null> for Null[src]

impl PartialOrd<Null> for Null[src]

impl Eq for Null[src]

impl Ord for Null[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl Clone for Null[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Null[src]

impl Display for Null[src]

impl Deref for Null[src]

type Target = Bytes

The resulting type after dereferencing.

impl Hash for Null[src]

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

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

Auto Trait Implementations

impl Send for Null

impl Sync for Null

Blanket Implementations

impl<T> RecordData for T where
    T: Compose + Compress + RtypeRecordData
[src]

impl<T> ParseRecordData for T where
    T: Compose + Compress + ParseAll + RtypeRecordData
[src]

type Err = <T as ParseAll>::Err

The type of an error returned when parsing fails.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

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

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

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

The type returned in the event of a conversion error.