Skip to main content

TypedSession

Struct TypedSession 

Source
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>

Source

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>

Source

pub fn map_transport<Next>( self, map: impl FnOnce(Transport) -> Next, ) -> TypedSession<Next, Phase, Cleanliness>

Replaces the transport representation without changing protocol indices.

Source

pub fn into_transport(self) -> Transport

Deliberately leaves the generated typestate API and returns its transport.

Source§

impl<Transport, Cleanliness> TypedSession<Transport, Auth, Cleanliness>

Source

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.

Source

pub fn ok(self) -> TypedSession<Transport, AwaitingStartupReady, Cleanliness>

Applies ok and enters AwaitingStartupReady.

Source

pub fn cleartext(self) -> TypedSession<Transport, PasswordResponse, Cleanliness>

Applies cleartext and enters PasswordResponse.

Source

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.

Source

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.

Source

pub fn gss(self) -> TypedSession<Transport, TokenResponse, Cleanliness>

Applies gss and enters TokenResponse.

Source

pub fn sspi(self) -> TypedSession<Transport, TokenResponse, Cleanliness>

Applies sspi and enters TokenResponse.

Source

pub fn kerberos_v5(self) -> TypedSession<Transport, TokenResponse, Cleanliness>

Applies kerberos_v5 and enters TokenResponse.

Source

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>

Source

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>

Source

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>

Source

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.

Source

pub fn ok(self) -> TypedSession<Transport, AwaitingStartupReady, Cleanliness>

Applies ok and enters AwaitingStartupReady.

Source

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>

Source

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>

Source

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.

Source

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.

Source

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>

Source

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>

Source

pub fn verified(self) -> TypedSession<Transport, AwaitingAuthOk, Cleanliness>

Applies verified and enters AwaitingAuthOk.

Source§

impl<Transport, Cleanliness> TypedSession<Transport, AwaitingAuthOk, Cleanliness>

Source

pub fn ok(self) -> TypedSession<Transport, AwaitingStartupReady, Cleanliness>

Applies ok and enters AwaitingStartupReady.

Source

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>

Source

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.

Trait Implementations§

Source§

impl<Transport: Debug, Phase: Debug, Cleanliness: Debug> Debug for TypedSession<Transport, Phase, Cleanliness>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Transport, Phase, Cleanliness> Freeze for TypedSession<Transport, Phase, Cleanliness>
where Transport: Freeze,

§

impl<Transport, Phase, Cleanliness> RefUnwindSafe for TypedSession<Transport, Phase, Cleanliness>
where Transport: RefUnwindSafe, Phase: RefUnwindSafe, Cleanliness: RefUnwindSafe,

§

impl<Transport, Phase, Cleanliness> Send for TypedSession<Transport, Phase, Cleanliness>
where Transport: Send, Phase: Send, Cleanliness: Send,

§

impl<Transport, Phase, Cleanliness> Sync for TypedSession<Transport, Phase, Cleanliness>
where Transport: Sync, Phase: Sync, Cleanliness: Sync,

§

impl<Transport, Phase, Cleanliness> Unpin for TypedSession<Transport, Phase, Cleanliness>
where Transport: Unpin, Phase: Unpin, Cleanliness: Unpin,

§

impl<Transport, Phase, Cleanliness> UnsafeUnpin for TypedSession<Transport, Phase, Cleanliness>
where Transport: UnsafeUnpin,

§

impl<Transport, Phase, Cleanliness> UnwindSafe for TypedSession<Transport, Phase, Cleanliness>
where Transport: UnwindSafe, Phase: UnwindSafe, Cleanliness: 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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> Same for T

Source§

type Output = T

Should always be Self
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.