Skip to main content

Connection

Struct Connection 

Source
pub struct Connection { /* private fields */ }

Implementations§

Source§

impl Connection

Source

pub fn new(config: Config) -> Result<Self>

Source

pub fn output(&self) -> &[u8] ⓘ

Source

pub fn consume_output(&mut self, n: usize) -> Result<()>

Source

pub fn receive(&mut self, bytes: &[u8]) -> Result<()>

Source

pub fn tls_established(&mut self) -> Result<()>

Acknowledge TLS without channel-binding data (plain SCRAM fallback).

Source

pub fn tls_established_with_channel_binding( &mut self, available: bool, ) -> Result<()>

Acknowledge verified TLS and whether the host can supply tls-server-end-point data to start_scram. The core prefers PLUS only when data is available.

Source

pub fn start_scram(&mut self, scram: ScramSha256) -> Result<()>

Source

pub fn query( &mut self, token: Token, sql: &str, deadline: Option<Instant>, ) -> Result<()>

Source

pub fn execute( &mut self, token: Token, query: ExtendedQuery<'_>, deadline: Option<Instant>, ) -> Result<()>

Every operation ends in Sync, so an error cannot discard a later token.

Source

pub fn copy_data(&mut self, bytes: &[u8]) -> Result<()>

Source

pub fn copy_finish(&mut self, error: Option<&str>) -> Result<()>

Source

pub fn cancel_request(&self) -> Option<[u8; 16]>

Send on a NEW connection; the main stream remains owned by this state machine.

Source

pub fn transaction_status(&self) -> TransactionStatus

Source

pub fn is_ready(&self) -> bool

Source

pub fn pending_count(&self) -> usize

Source

pub fn next_timeout(&self) -> Option<Instant>

Source

pub fn handle_timeout(&mut self, now: Instant)

Source

pub fn abort(&mut self, reason: Error)

Transport EOF, TLS failure, cancellation or malformed input terminates all pending tokens once. Pull Completed events followed by Closed.

Source

pub fn end(&mut self) -> Result<()>

Source

pub fn next_event(&mut self) -> Result<Option<Event<'_>>>

Pull the next borrowed event. A terminal server ErrorResponse returns Error::ConnectionAborted immediately and makes the session unusable. Continue pulling to drain one Aborted completion per pending token, then Closed; a later transport abort cannot replace the server diagnostic.

Auto Trait Implementations§

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<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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.