pub struct Serial(pub u32);
Expand description

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 two operations: addition and comparison.

For addition, the amount added can only be a positive number of up to 2^31 - 1. Because of this, 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.

Tuple Fields

0: u32

Implementations

Returns a serial number for the current Unix time.

Returns the serial number as a raw integer.

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.

Scan a serial represention signature time value.

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

Trait Implementations

Returns the canonical ordering between self and other.

Returns whether self is canonically less than other.

Returns whether self is canonically less than or equal to other.

Returns whether self is canonically greater than other.

Returns whether self is canonically greater than or equal to other.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Appends the concrete representation of the value to the target. Read more

Appends the canonical representation of the value to the target. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

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

Extracts a value from the beginning of parser. Read more

Skips over a value of this type at the beginning of parser. Read more

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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

Available on crate feature master only.

Scans a value from a master file.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Performs the conversion.

The resulting type after obtaining ownership.

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

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.