Skip to main content

Session

Struct Session 

Source
pub struct Session<S>
where S: SessionState,
{ pub session_id: String, /* private fields */ }
Expand description

Session wrapper with typestate for compile-time state checking.

The type parameter S represents the current session state.

Fields§

§session_id: String

Session identifier.

Implementations§

Source§

impl<S> Session<S>
where S: SessionState,

Source

pub fn session_id(&self) -> &str

Returns the session identifier.

Source§

impl Session<Disconnected>

Source

pub fn new(session_id: impl Into<String>) -> Session<Disconnected>

Creates a new disconnected session.

§Arguments
  • session_id - Unique identifier for this session
Source

pub fn connect(self) -> Session<Connecting>

Transitions to the Connecting state.

Source§

impl Session<Connecting>

Source

pub fn send_logon(self) -> Session<LogonSent>

Transitions to the LogonSent state after sending Logon.

Source

pub fn disconnect(self) -> Session<Disconnected>

Transitions back to Disconnected on connection failure.

Source§

impl Session<LogonSent>

Source

pub fn on_logon_ack(self) -> Session<Active>

Transitions to Active state on successful Logon acknowledgement.

Source

pub fn on_logon_reject(self) -> Session<Disconnected>

Transitions to Disconnected on Logon rejection or timeout.

Source§

impl Session<Active>

Source

pub fn start_resend(self, _begin_seq: u64, _end_seq: u64) -> Session<Resending>

Transitions to Resending state when a gap is detected.

§Arguments
  • begin_seq - Begin sequence number of the gap
  • end_seq - End sequence number of the gap
Source

pub fn initiate_logout(self) -> Session<LogoutPending>

Transitions to LogoutPending state.

Source

pub fn disconnect(self) -> Session<Disconnected>

Transitions to Disconnected on unexpected disconnect.

Source§

impl Session<Resending>

Source

pub fn resend_complete(self) -> Session<Active>

Transitions back to Active when resend is complete.

Source

pub fn disconnect(self) -> Session<Disconnected>

Transitions to Disconnected on error.

Source§

impl Session<LogoutPending>

Source

pub fn on_logout_ack(self) -> Session<Disconnected>

Transitions to Disconnected on Logout acknowledgement or timeout.

Source

pub fn on_timeout(self) -> Session<Disconnected>

Transitions to Disconnected on timeout.

Trait Implementations§

Source§

impl<S> Debug for Session<S>
where S: Debug + SessionState,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> Freeze for Session<S>

§

impl<S> RefUnwindSafe for Session<S>
where S: RefUnwindSafe,

§

impl<S> Send for Session<S>
where S: Send,

§

impl<S> Sync for Session<S>
where S: Sync,

§

impl<S> Unpin for Session<S>
where S: Unpin,

§

impl<S> UnwindSafe for Session<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.