[][src]Struct rpki_rtr::state::State

pub struct State { /* fields omitted */ }

The RTR session state.

This state consists of a session ID describing a continuous session with the same evolving data set a server is running and a serial number that describes a particular version of this set.

Both a session ID and an initial serial number are chosen when a new session is started. Whenever data is being updated, the serial number is increased by one.

This type contains both these values. You can create the state values for a new session with new and increase the serial number with inc.

Implementations

impl State[src]

pub fn new() -> Self[src]

Creates a state value for a new session.

This will pick a session ID based on the lower 16 bit of the current Unix time and an initial serial of 0. If you want to choose a different starting serial, you can use new_with_serial instead.

pub fn new_with_serial(serial: Serial) -> Self[src]

Creates a state value with a given initial serial number.

The function will use a session ID based on the lower 16 bit of the current time and an initial serial of serial.

pub fn from_parts(session: u16, serial: Serial) -> Self[src]

Creates a new state value from its components.

pub fn inc(&mut self)[src]

Increases the serial number by one.

Serial number may wrap but that’s totally fine. See Serial for more details.

pub fn session(self) -> u16[src]

Returns the session ID.

pub fn serial(self) -> Serial[src]

Returns the serial number.

Trait Implementations

impl Clone for State[src]

impl Copy for State[src]

impl Debug for State[src]

impl Default for State[src]

Auto Trait Implementations

impl RefUnwindSafe for State

impl Send for State

impl Sync for State

impl Unpin for State

impl UnwindSafe for State

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.