#[repr(transparent)]pub struct Serial(pub U32);Available on crate feature
unstable-new only.Expand description
Tuple Fields§
§0: U32Implementations§
Source§impl Serial
impl Serial
Sourcepub fn inc(self, num: i32) -> Self
pub fn inc(self, num: i32) -> Self
Increment this by a non-negative number.
The number must be in the range [0, 2^31 - 1]. An i32 is used
instead of a u32 because it is easier to understand and implement
a non-negative check versus the upper range check.
Section 7 in RFC1982 states, in particular for the SOA Serial Number, but for any Serial number using a “SERIAL_BITS” value of 32: “The maximum defined increment is 2147483647 (2^31 - 1).”
§Panics
Panics if the number is negative.
Trait Implementations§
Source§impl BuildBytes for Serial
impl BuildBytes for Serial
Source§fn build_bytes<'bytes>(
&self,
bytes: &'bytes mut [u8],
) -> Result<&'bytes mut [u8], TruncationError>
fn build_bytes<'bytes>( &self, bytes: &'bytes mut [u8], ) -> Result<&'bytes mut [u8], TruncationError>
Serialize into a byte sequence. Read more
Source§fn built_bytes_size(&self) -> usize
fn built_bytes_size(&self) -> usize
The size of
self when serialized into a byte sequence. Read moreimpl Copy for Serial
impl Eq for Serial
Source§impl<'bytes> ParseBytes<'bytes> for Serialwhere
U32: ParseBytes<'bytes>,
impl<'bytes> ParseBytes<'bytes> for Serialwhere
U32: ParseBytes<'bytes>,
Source§fn parse_bytes(bytes: &'bytes [u8]) -> Result<Self, ParseError>
fn parse_bytes(bytes: &'bytes [u8]) -> Result<Self, ParseError>
Source§impl ParseBytesZC for Serial
impl ParseBytesZC for Serial
Source§fn parse_bytes_by_ref(bytes: &[u8]) -> Result<&Self, ParseError>
fn parse_bytes_by_ref(bytes: &[u8]) -> Result<&Self, ParseError>
Source§fn parse_bytes_in<C: ParseBytesInPlace>(
container: C,
) -> Result<C::WithParsed<Self>, (C, ParseError)>
fn parse_bytes_in<C: ParseBytesInPlace>( container: C, ) -> Result<C::WithParsed<Self>, (C, ParseError)>
Parse bytes within the given container. Read more
Source§impl PartialOrd for Serial
impl PartialOrd for Serial
Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
The comparison of Serial Number values is defined in Section 3.2 RFC1982.
Source§impl<'bytes> SplitBytes<'bytes> for Serialwhere
U32: SplitBytes<'bytes>,
impl<'bytes> SplitBytes<'bytes> for Serialwhere
U32: SplitBytes<'bytes>,
Source§fn split_bytes(bytes: &'bytes [u8]) -> Result<(Self, &'bytes [u8]), ParseError>
fn split_bytes(bytes: &'bytes [u8]) -> Result<(Self, &'bytes [u8]), ParseError>
Source§impl SplitBytesZC for Serial
impl SplitBytesZC for Serial
Source§fn split_bytes_by_ref(bytes: &[u8]) -> Result<(&Self, &[u8]), ParseError>
fn split_bytes_by_ref(bytes: &[u8]) -> Result<(&Self, &[u8]), ParseError>
impl StructuralPartialEq for Serial
Source§impl UnsizedCopy for Serial
impl UnsizedCopy for Serial
Source§type Alignment = (<U32 as UnsizedCopy>::Alignment,)
type Alignment = (<U32 as UnsizedCopy>::Alignment,)
A type with the same alignment as
Self. Read moreSource§fn ptr_with_addr(&self, addr: *const ()) -> *const Self
fn ptr_with_addr(&self, addr: *const ()) -> *const Self
Change the address of a pointer to
Self. Read moreSource§fn unsized_copy_into<T: UnsizedCopyFrom<Source = Self>>(&self) -> T
fn unsized_copy_into<T: UnsizedCopyFrom<Source = Self>>(&self) -> T
Copy
self into a new container. Read moreAuto Trait Implementations§
impl Freeze for Serial
impl RefUnwindSafe for Serial
impl Send for Serial
impl Sync for Serial
impl Unpin for Serial
impl UnsafeUnpin for Serial
impl UnwindSafe for Serial
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
Source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
Source§fn octets_into(self) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.