[−][src]Struct routinator::rtr::Serial
A serial number.
Serial numbers are regular integers with a special notion for comparison in order to be able to deal with roll-over.
Specifically, addition and comparison are defined in RFC 1982.
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 from_be(value: u32) -> Self
[src]
pub fn to_be(self) -> u32
[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
.
Trait Implementations
impl From<u32> for Serial
[src]
impl From<Serial> for u32
[src]
impl Clone for Serial
[src]
impl Copy for Serial
[src]
impl Eq for Serial
[src]
impl PartialEq<Serial> for Serial
[src]
impl PartialEq<u32> for Serial
[src]
impl PartialOrd<Serial> for Serial
[src]
fn partial_cmp(&self, other: &Serial) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
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.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Hash for Serial
[src]
Auto Trait Implementations
impl Send for Serial
impl Sync for Serial
impl Unpin for Serial
impl UnwindSafe for Serial
impl RefUnwindSafe for Serial
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<'a, T> TryFrom<&'a str> for T where
T: FromStr,
T: FromStr,
type Err = <T as FromStr>::Err
fn try_from(string: &'a str) -> Result<T, <T as TryFrom<&'a str>>::Err>
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,