pub struct Session<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, and the value
of that state is stored: see the module documentation.
Fields§
§session_id: StringSession identifier.
Implementations§
Source§impl<S: SessionState> Session<S>
impl<S: SessionState> Session<S>
Source§impl Session<Disconnected>
impl Session<Disconnected>
Sourcepub fn connect(self) -> Session<Connecting>
pub fn connect(self) -> Session<Connecting>
Transitions to the Connecting state (initiator side).
Sourcepub fn accept(self) -> Session<Connecting>
pub fn accept(self) -> Session<Connecting>
Transitions to the Connecting state after accepting an inbound TCP connection (acceptor side).
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 (initiator side), recording the send instant for the logon timeout.
Sourcepub fn on_logon_received(self) -> Session<LogonReceived>
pub fn on_logon_received(self) -> Session<LogonReceived>
Transitions to the LogonReceived state when a Logon arrives from the counterparty (acceptor side), recording the arrival instant.
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<LogonReceived>
impl Session<LogonReceived>
Sourcepub const fn received_at(&self) -> Instant
pub const fn received_at(&self) -> Instant
Returns when the counterparty’s Logon arrived, for the authentication deadline.
Sourcepub fn accept_logon(self) -> Session<Active>
pub fn accept_logon(self) -> Session<Active>
Transitions to Active after successful authentication, once the Logon acknowledgement has been sent back to the counterparty.
Sourcepub fn reject_logon(self) -> Session<Disconnected>
pub fn reject_logon(self) -> Session<Disconnected>
Transitions to Disconnected when authentication fails and the Logon is rejected (Logout/Reject sent, connection dropped).
Sourcepub fn on_timeout(self) -> Session<Disconnected>
pub fn on_timeout(self) -> Session<Disconnected>
Transitions to Disconnected when authentication does not complete within the allowed time.
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, carrying the range the resend covers.
§Arguments
begin_seq-BeginSeqNo(7) of the gapend_seq-EndSeqNo(16) of the gap;0means “through the last message sent”, the FIX convention
Sourcepub fn initiate_logout(self) -> Session<LogoutPending>
pub fn initiate_logout(self) -> Session<LogoutPending>
Transitions to LogoutPending state, recording the send instant for the logout timeout.
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 const fn end_seq(&self) -> u64
pub const fn end_seq(&self) -> u64
Returns EndSeqNo (16) of the range being resent; 0 means “through
the last message sent”.
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 const fn sent_at(&self) -> Instant
pub const fn sent_at(&self) -> Instant
Returns when the Logout was sent, for the logout_timeout.
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.