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

Acknowledge n written bytes of output().

Returns true when an event is now deliverable without further input, in which case the host must call next_event() right away. This matters for COM_STMT_CLOSE and COM_QUIT: the server never answers them, so their Completed / Closed is produced by this acknowledgement itself and no read completion or timer would otherwise wake a completion-driven host.

Source

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

Source

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

Source

pub fn rsa_seed(&mut self, seed: [u8; 20]) -> Result<()>

RSA OAEP SHA1 consumes this one-use, host-generated cryptographic seed.

Source

pub fn can_accept(&self) -> bool

Whether a command submitted now would be admitted. This is the exact rule every command method applies: the session is authenticated and idle, the previous command’s Completed has been delivered and all output has been acknowledged. A host queue can gate submission on it instead of copying the preconditions. Unlike is_ready, it also requires flushed output.

Source

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

Source

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

Source

pub fn execute( &mut self, token: Token, id: u32, params: &[Value], deadline: Option<Instant>, ) -> Result<()>

Source

pub fn ping(&mut self, token: Token) -> Result<()>

Source

pub fn reset_connection(&mut self, token: Token) -> Result<()>

Source

pub fn reset_statement(&mut self, token: Token, id: u32) -> Result<()>

Source

pub fn close_statement(&mut self, token: Token, id: u32) -> Result<()>

Source

pub fn statements(&self) -> &[Statement]

Prepared statements the server still holds for this session. A statement being closed stays listed until its COM_STMT_CLOSE bytes are acknowledged.

Source

pub fn change_user( &mut self, token: Token, user: String, password: Vec<u8>, database: Option<String>, ) -> Result<()>

Source

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

Source

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

Source

pub fn is_ready(&self) -> bool

Source

pub fn status(&self) -> StatusFlags

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)

Source

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

Source

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

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.