pub struct TypedSession<Transport, Phase, Cleanliness = ()> { /* private fields */ }Expand description
Transport-carrying typestate for this protocol role.
Implementations§
Source§impl<Transport, Cleanliness> TypedSession<Transport, Auth, Cleanliness>
impl<Transport, Cleanliness> TypedSession<Transport, Auth, Cleanliness>
Sourcepub const fn with_transport(transport: Transport) -> Self
pub const fn with_transport(transport: Transport) -> Self
Attaches transport to a session in the initial phase.
Source§impl<Transport, Phase, Cleanliness> TypedSession<Transport, Phase, Cleanliness>
impl<Transport, Phase, Cleanliness> TypedSession<Transport, Phase, Cleanliness>
Sourcepub fn map_transport<Next>(
self,
map: impl FnOnce(Transport) -> Next,
) -> TypedSession<Next, Phase, Cleanliness>
pub fn map_transport<Next>( self, map: impl FnOnce(Transport) -> Next, ) -> TypedSession<Next, Phase, Cleanliness>
Replaces the transport representation without changing protocol indices.
Sourcepub fn into_transport(self) -> Transport
pub fn into_transport(self) -> Transport
Deliberately leaves the generated typestate API and returns its transport.
Source§impl<Transport, Cleanliness> TypedSession<Transport, Auth, Cleanliness>
impl<Transport, Cleanliness> TypedSession<Transport, Auth, Cleanliness>
Sourcepub fn negotiate<Output, Error>(
self,
payload: NegotiateProtocolVersion,
handle: impl FnOnce(&mut Transport, NegotiateProtocolVersion) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, Auth, Cleanliness>, Output), (Self, Error)>
pub fn negotiate<Output, Error>( self, payload: NegotiateProtocolVersion, handle: impl FnOnce(&mut Transport, NegotiateProtocolVersion) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, Auth, Cleanliness>, Output), (Self, Error)>
Handles the payload for negotiate; success enters Auth and failure returns the unchanged session.
Sourcepub fn ok(self) -> TypedSession<Transport, AwaitingStartupReady, Cleanliness>
pub fn ok(self) -> TypedSession<Transport, AwaitingStartupReady, Cleanliness>
Applies ok and enters AwaitingStartupReady.
Sourcepub fn cleartext(self) -> TypedSession<Transport, PasswordResponse, Cleanliness>
pub fn cleartext(self) -> TypedSession<Transport, PasswordResponse, Cleanliness>
Applies cleartext and enters PasswordResponse.
Sourcepub fn md5<Output, Error>(
self,
payload: [u8; 4],
handle: impl FnOnce(&mut Transport, [u8; 4]) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, PasswordResponse, Cleanliness>, Output), (Self, Error)>
pub fn md5<Output, Error>( self, payload: [u8; 4], handle: impl FnOnce(&mut Transport, [u8; 4]) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, PasswordResponse, Cleanliness>, Output), (Self, Error)>
Handles the payload for md5; success enters PasswordResponse and failure returns the unchanged session.
Sourcepub fn sasl<Output, Error>(
self,
payload: Vec<Bytes>,
handle: impl FnOnce(&mut Transport, Vec<Bytes>) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, SaslInitial, Cleanliness>, Output), (Self, Error)>
pub fn sasl<Output, Error>( self, payload: Vec<Bytes>, handle: impl FnOnce(&mut Transport, Vec<Bytes>) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, SaslInitial, Cleanliness>, Output), (Self, Error)>
Handles the payload for sasl; success enters SaslInitial and failure returns the unchanged session.
Sourcepub fn gss(self) -> TypedSession<Transport, TokenResponse, Cleanliness>
pub fn gss(self) -> TypedSession<Transport, TokenResponse, Cleanliness>
Applies gss and enters TokenResponse.
Sourcepub fn sspi(self) -> TypedSession<Transport, TokenResponse, Cleanliness>
pub fn sspi(self) -> TypedSession<Transport, TokenResponse, Cleanliness>
Applies sspi and enters TokenResponse.
Sourcepub fn kerberos_v5(self) -> TypedSession<Transport, TokenResponse, Cleanliness>
pub fn kerberos_v5(self) -> TypedSession<Transport, TokenResponse, Cleanliness>
Applies kerberos_v5 and enters TokenResponse.
Sourcepub fn error<Output, Error>(
self,
payload: DiagnosticResponse,
handle: impl FnOnce(&mut Transport, DiagnosticResponse) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, Terminated, Cleanliness>, Output), (Self, Error)>
pub fn error<Output, Error>( self, payload: DiagnosticResponse, handle: impl FnOnce(&mut Transport, DiagnosticResponse) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, Terminated, Cleanliness>, Output), (Self, Error)>
Handles the payload for error; success enters Terminated and failure returns the unchanged session.
Source§impl<Transport, Cleanliness> TypedSession<Transport, PasswordResponse, Cleanliness>
impl<Transport, Cleanliness> TypedSession<Transport, PasswordResponse, Cleanliness>
Sourcepub fn password<Output, Error>(
self,
payload: Bytes,
handle: impl FnOnce(&mut Transport, Bytes) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, AwaitingAuthOk, Cleanliness>, Output), (Self, Error)>
pub fn password<Output, Error>( self, payload: Bytes, handle: impl FnOnce(&mut Transport, Bytes) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, AwaitingAuthOk, Cleanliness>, Output), (Self, Error)>
Handles the payload for password; success enters AwaitingAuthOk and failure returns the unchanged session.
Source§impl<Transport, Cleanliness> TypedSession<Transport, TokenResponse, Cleanliness>
impl<Transport, Cleanliness> TypedSession<Transport, TokenResponse, Cleanliness>
Sourcepub fn response<Output, Error>(
self,
payload: Bytes,
handle: impl FnOnce(&mut Transport, Bytes) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, TokenChallenge, Cleanliness>, Output), (Self, Error)>
pub fn response<Output, Error>( self, payload: Bytes, handle: impl FnOnce(&mut Transport, Bytes) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, TokenChallenge, Cleanliness>, Output), (Self, Error)>
Handles the payload for response; success enters TokenChallenge and failure returns the unchanged session.
Source§impl<Transport, Cleanliness> TypedSession<Transport, TokenChallenge, Cleanliness>
impl<Transport, Cleanliness> TypedSession<Transport, TokenChallenge, Cleanliness>
Sourcepub fn continue_token<Output, Error>(
self,
payload: Bytes,
handle: impl FnOnce(&mut Transport, Bytes) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, TokenResponse, Cleanliness>, Output), (Self, Error)>
pub fn continue_token<Output, Error>( self, payload: Bytes, handle: impl FnOnce(&mut Transport, Bytes) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, TokenResponse, Cleanliness>, Output), (Self, Error)>
Handles the payload for continue_token; success enters TokenResponse and failure returns the unchanged session.
Sourcepub fn ok(self) -> TypedSession<Transport, AwaitingStartupReady, Cleanliness>
pub fn ok(self) -> TypedSession<Transport, AwaitingStartupReady, Cleanliness>
Applies ok and enters AwaitingStartupReady.
Sourcepub fn error<Output, Error>(
self,
payload: DiagnosticResponse,
handle: impl FnOnce(&mut Transport, DiagnosticResponse) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, Terminated, Cleanliness>, Output), (Self, Error)>
pub fn error<Output, Error>( self, payload: DiagnosticResponse, handle: impl FnOnce(&mut Transport, DiagnosticResponse) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, Terminated, Cleanliness>, Output), (Self, Error)>
Handles the payload for error; success enters Terminated and failure returns the unchanged session.
Source§impl<Transport, Cleanliness> TypedSession<Transport, SaslInitial, Cleanliness>
impl<Transport, Cleanliness> TypedSession<Transport, SaslInitial, Cleanliness>
Sourcepub fn initial<Output, Error>(
self,
payload: SaslInitialResponse,
handle: impl FnOnce(&mut Transport, SaslInitialResponse) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, Sasl, Cleanliness>, Output), (Self, Error)>
pub fn initial<Output, Error>( self, payload: SaslInitialResponse, handle: impl FnOnce(&mut Transport, SaslInitialResponse) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, Sasl, Cleanliness>, Output), (Self, Error)>
Handles the payload for initial; success enters Sasl and failure returns the unchanged session.
Source§impl<Transport, Cleanliness> TypedSession<Transport, Sasl, Cleanliness>
impl<Transport, Cleanliness> TypedSession<Transport, Sasl, Cleanliness>
Sourcepub fn continue_response<Output, Error>(
self,
payload: Bytes,
handle: impl FnOnce(&mut Transport, Bytes) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, SaslChallenge, Cleanliness>, Output), (Self, Error)>
pub fn continue_response<Output, Error>( self, payload: Bytes, handle: impl FnOnce(&mut Transport, Bytes) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, SaslChallenge, Cleanliness>, Output), (Self, Error)>
Handles the payload for continue_response; success enters SaslChallenge and failure returns the unchanged session.
Sourcepub fn final_response<Output, Error>(
self,
payload: Bytes,
handle: impl FnOnce(&mut Transport, Bytes) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, SaslFinal, Cleanliness>, Output), (Self, Error)>
pub fn final_response<Output, Error>( self, payload: Bytes, handle: impl FnOnce(&mut Transport, Bytes) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, SaslFinal, Cleanliness>, Output), (Self, Error)>
Handles the payload for final_response; success enters SaslFinal and failure returns the unchanged session.
Sourcepub fn error<Output, Error>(
self,
payload: DiagnosticResponse,
handle: impl FnOnce(&mut Transport, DiagnosticResponse) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, Terminated, Cleanliness>, Output), (Self, Error)>
pub fn error<Output, Error>( self, payload: DiagnosticResponse, handle: impl FnOnce(&mut Transport, DiagnosticResponse) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, Terminated, Cleanliness>, Output), (Self, Error)>
Handles the payload for error; success enters Terminated and failure returns the unchanged session.
Source§impl<Transport, Cleanliness> TypedSession<Transport, SaslChallenge, Cleanliness>
impl<Transport, Cleanliness> TypedSession<Transport, SaslChallenge, Cleanliness>
Sourcepub fn response<Output, Error>(
self,
payload: Bytes,
handle: impl FnOnce(&mut Transport, Bytes) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, Sasl, Cleanliness>, Output), (Self, Error)>
pub fn response<Output, Error>( self, payload: Bytes, handle: impl FnOnce(&mut Transport, Bytes) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, Sasl, Cleanliness>, Output), (Self, Error)>
Handles the payload for response; success enters Sasl and failure returns the unchanged session.
Source§impl<Transport, Cleanliness> TypedSession<Transport, SaslFinal, Cleanliness>
impl<Transport, Cleanliness> TypedSession<Transport, SaslFinal, Cleanliness>
Sourcepub fn verified(self) -> TypedSession<Transport, AwaitingAuthOk, Cleanliness>
pub fn verified(self) -> TypedSession<Transport, AwaitingAuthOk, Cleanliness>
Applies verified and enters AwaitingAuthOk.
Source§impl<Transport, Cleanliness> TypedSession<Transport, AwaitingAuthOk, Cleanliness>
impl<Transport, Cleanliness> TypedSession<Transport, AwaitingAuthOk, Cleanliness>
Sourcepub fn ok(self) -> TypedSession<Transport, AwaitingStartupReady, Cleanliness>
pub fn ok(self) -> TypedSession<Transport, AwaitingStartupReady, Cleanliness>
Applies ok and enters AwaitingStartupReady.
Sourcepub fn error<Output, Error>(
self,
payload: DiagnosticResponse,
handle: impl FnOnce(&mut Transport, DiagnosticResponse) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, Terminated, Cleanliness>, Output), (Self, Error)>
pub fn error<Output, Error>( self, payload: DiagnosticResponse, handle: impl FnOnce(&mut Transport, DiagnosticResponse) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, Terminated, Cleanliness>, Output), (Self, Error)>
Handles the payload for error; success enters Terminated and failure returns the unchanged session.
Source§impl<Transport, Cleanliness> TypedSession<Transport, AwaitingStartupReady, Cleanliness>
impl<Transport, Cleanliness> TypedSession<Transport, AwaitingStartupReady, Cleanliness>
Sourcepub fn ready<Output, Error>(
self,
payload: TransactionStatus,
handle: impl FnOnce(&mut Transport, TransactionStatus) -> Result<Output, Error>,
) -> Result<(TypedSession<Transport, Ready, Cleanliness>, Output), (Self, Error)>
pub fn ready<Output, Error>( self, payload: TransactionStatus, handle: impl FnOnce(&mut Transport, TransactionStatus) -> Result<Output, Error>, ) -> Result<(TypedSession<Transport, Ready, Cleanliness>, Output), (Self, Error)>
Handles the payload for ready; success enters Ready and failure returns the unchanged session.