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

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.

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.

Creates a new state value from its components.

Increases the serial number by one.

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

Returns the session ID.

Returns the serial number.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. 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.

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

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.