pub struct ConnectionState(/* private fields */);
Expand description
ASCII state diagram for the connection state machine
stateDiagram-v2
[*] --> SslInitializing: SSL not disabled
[*] --> Initializing: SSL disabled
SslInitializing --> SslWaiting: Send SSL request
SslWaiting --> SslConnecting: SSL accepted
SslWaiting --> Connecting: SSL rejected (if not required)
SslConnecting --> Connecting: SSL handshake complete
Initializing --> Connecting: Send startup message
Connecting --> Connected: Authentication successful
Connecting --> Scram: SCRAM auth requested
Scram --> Connected: SCRAM auth successful
Connected --> Ready: Parameter sync complete
Ready --> [*]: Connection closed
state Error {
[*] --> [*]: Any state can transition to Error
}
The state machine for a Postgres connection. The state machine is driven
with calls to Self::drive
.
Implementations§
Source§impl ConnectionState
impl ConnectionState
pub fn new(credentials: Credentials, ssl_mode: ConnectionSslRequirement) -> Self
pub fn is_ready(&self) -> bool
pub fn is_error(&self) -> bool
pub fn is_done(&self) -> bool
pub fn read_ssl_response(&self) -> bool
pub fn drive( &mut self, drive: ConnectionDrive<'_>, update: &mut impl ConnectionStateUpdate, ) -> Result<(), ConnectionError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConnectionState
impl RefUnwindSafe for ConnectionState
impl Send for ConnectionState
impl Sync for ConnectionState
impl Unpin for ConnectionState
impl UnwindSafe for ConnectionState
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
Source§impl<T> EncoderForExt for Twhere
T: ?Sized,
impl<T> EncoderForExt for Twhere
T: ?Sized,
Source§fn to_vec<F>(&self) -> Vec<u8> ⓘwhere
F: 'static,
Self: EncoderFor<F>,
fn to_vec<F>(&self) -> Vec<u8> ⓘwhere
F: 'static,
Self: EncoderFor<F>,
Convert this builder into a vector of bytes. This is generally
not the most efficient way to perform serialization.
Source§fn encode_buffer<F>(&self, buf: &mut [u8]) -> Result<usize, usize>where
F: 'static,
Self: EncoderFor<F>,
fn encode_buffer<F>(&self, buf: &mut [u8]) -> Result<usize, usize>where
F: 'static,
Self: EncoderFor<F>,
Encode this builder into a given buffer. If the buffer is
too small, the function will return the number of bytes
required to encode the builder.
Source§fn encode_buffer_uninit<'a, F>(
&self,
buf: &'a mut [MaybeUninit<u8>],
) -> Result<&'a mut [u8], usize>where
F: 'static,
Self: EncoderFor<F>,
fn encode_buffer_uninit<'a, F>(
&self,
buf: &'a mut [MaybeUninit<u8>],
) -> Result<&'a mut [u8], usize>where
F: 'static,
Self: EncoderFor<F>,
Encode this builder into a given buffer. If the buffer is
too small, the function will return the number of bytes
required to encode the builder.