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: StringSession identifier.
Implementations§
Source§impl<S> Session<S>where
S: SessionState,
impl<S> Session<S>where
S: SessionState,
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Returns the session identifier.
Source§impl Session<Disconnected>
impl Session<Disconnected>
Source§impl Session<Connecting>
impl Session<Connecting>
Sourcepub fn send_logon(self) -> Session<LogonSent>
pub fn send_logon(self) -> Session<LogonSent>
Transitions to the LogonSent state after sending Logon.
Sourcepub fn disconnect(self) -> Session<Disconnected>
pub fn disconnect(self) -> Session<Disconnected>
Transitions back to Disconnected on connection failure.
Source§impl Session<LogonSent>
impl Session<LogonSent>
Sourcepub fn on_logon_ack(self) -> Session<Active>
pub fn on_logon_ack(self) -> Session<Active>
Transitions to Active state on successful Logon acknowledgement.
Sourcepub fn on_logon_reject(self) -> Session<Disconnected>
pub fn on_logon_reject(self) -> Session<Disconnected>
Transitions to Disconnected on Logon rejection or timeout.
Source§impl Session<Active>
impl Session<Active>
Sourcepub fn start_resend(self, _begin_seq: u64, _end_seq: u64) -> Session<Resending>
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 gapend_seq- End sequence number of the gap
Sourcepub fn initiate_logout(self) -> Session<LogoutPending>
pub fn initiate_logout(self) -> Session<LogoutPending>
Transitions to LogoutPending state.
Sourcepub fn disconnect(self) -> Session<Disconnected>
pub fn disconnect(self) -> Session<Disconnected>
Transitions to Disconnected on unexpected disconnect.
Source§impl Session<Resending>
impl Session<Resending>
Sourcepub fn resend_complete(self) -> Session<Active>
pub fn resend_complete(self) -> Session<Active>
Transitions back to Active when resend is complete.
Sourcepub fn disconnect(self) -> Session<Disconnected>
pub fn disconnect(self) -> Session<Disconnected>
Transitions to Disconnected on error.
Source§impl Session<LogoutPending>
impl Session<LogoutPending>
Sourcepub fn on_logout_ack(self) -> Session<Disconnected>
pub fn on_logout_ack(self) -> Session<Disconnected>
Transitions to Disconnected on Logout acknowledgement or timeout.
Sourcepub fn on_timeout(self) -> Session<Disconnected>
pub fn on_timeout(self) -> Session<Disconnected>
Transitions to Disconnected on timeout.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more