pub struct State { /* private fields */ }
Expand description
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
sourceimpl State
impl State
sourcepub fn new() -> Self
pub fn new() -> Self
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.
sourcepub fn new_with_serial(serial: Serial) -> Self
pub fn new_with_serial(serial: Serial) -> Self
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
.
sourcepub fn from_parts(session: u16, serial: Serial) -> Self
pub fn from_parts(session: u16, serial: Serial) -> Self
Creates a new state value from its components.
Trait Implementations
impl Copy for State
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more