[][src]Struct domain_core::bits::serial::Serial

pub struct Serial(pub u32);

A serial number.

Serial numbers are used in DNS to track changes to resources. For instance, the [Soa] record type provides a serial number that expresses the version of the zone. Since these numbers are only 32 bits long, they can wrap. RFC 1982 defined the semantics for doing arithmetics in the face of these wrap-arounds. This type implements these semantics atop a native u32.

The RFC defines addition and comparison. Addition, however, is only defined for values up to 2^31 - 1, so we decided to not implement the Add trait but rather have a dedicated method add so as to not cause surprise panics.

Serial numbers only implement a partial ordering. That is, there are pairs of values that are not equal but there still isn’t one value larger than the other. Since this is neatly implemented by the PartialOrd trait, the type implements that.

Methods

impl Serial[src]

pub fn add(self, other: u32) -> Self[src]

Add other to self.

Serial numbers only allow values of up to 2^31 - 1 to be added to them. Therefore, this method requires other to be a u32 instead of a Serial to indicate that you cannot simply add two serials together. This is also why we don’t implement the Add trait.

Panics

This method panics if other is greater than 2^31 - 1.

pub fn scan_rrsig<C: CharSource>(
    scanner: &mut Scanner<C>
) -> Result<Self, ScanError>
[src]

Scan a serial represention signature time values.

In RRSIG records, the expiration and inception time is given as serial values. Their master file format can either be the signature value or a specific date in YYYYMMDDHHmmSS format.

Trait Implementations

impl Compose for Serial[src]

impl Parse for Serial[src]

type Err = <u32 as Parse>::Err

The type of an error returned when parsing fails.

impl ParseAll for Serial[src]

type Err = <u32 as ParseAll>::Err

The type returned when parsing fails.

impl Scan for Serial[src]

impl Eq for Serial[src]

impl Clone for Serial[src]

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

Performs copy-assignment from source. Read more

impl Copy for Serial[src]

impl PartialOrd<Serial> for Serial[src]

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0
[src]

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

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

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

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0
[src]

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

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

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

impl PartialEq<Serial> for Serial[src]

impl From<u32> for Serial[src]

impl From<Serial> for u32[src]

impl Hash for Serial[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

impl Debug for Serial[src]

impl Display for Serial[src]

impl FromStr for Serial[src]

type Err = <u32 as FromStr>::Err

The associated error which can be returned from parsing.

Auto Trait Implementations

impl Send for Serial

impl Sync for Serial

Blanket Implementations

impl<T, U> Into for T where
    U: From<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> From for T[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, 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.

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

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