pub struct Client { /* private fields */ }
Expand description

A reconnecting version of super::Client.

Does not reconnect automatically but provides a method Client::reconnect for explicit reconnection, when the user finds it necessary. Can be cloned to utilize the same connection from multiple fibers.

See super::AsClient for the full API.

Implementations§

source§

impl Client

source

pub fn reconnect(&self)

Request client to reconnect before executing next operation.

If one of the cloned clients (used in other fibers/places) has already reconnected, this client will use this new connection instead of trying to establish a new one.

When reconnection happens ongoing requests (processing in other fibers) will continue on the old connection, but any new request will use the new connection.

source

pub async fn reconnect_now(&self) -> Result<(), Error>

Force reconnection.

If one of the cloned clients (used in other fibers/places) has already reconnected, this client will use this new connection instead of trying to establish a new one.

When reconnection happens ongoing requests (processing in other fibers) will continue on the old connection, but any new request will use the new connection.

Errors

Error is returned if reconnection fails. See Error.

source

pub fn new(url: String, port: u16) -> Self

Creates a new client but does not yet try to establish connection to url:port. This will happen at the first call through super::AsClient methods.

Trait Implementations§

source§

impl AsClient for Client

source§

fn send<'life0, 'life1, 'async_trait, R>( &'life0 self, request: &'life1 R ) -> Pin<Box<dyn Future<Output = Result<R::Response, Error>> + 'async_trait>>
where R: 'async_trait + Request, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send Request and wait for response. This function yields. Read more
source§

fn ping<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute a PING command.
source§

fn call<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, fn_name: &'life1 str, args: &'life2 T ) -> Pin<Box<dyn Future<Output = Result<Tuple, Error>> + 'async_trait>>
where T: ToTupleBuffer + ?Sized + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Call a remote stored procedure. Read more
source§

fn eval<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, expr: &'life1 str, args: &'life2 T ) -> Pin<Box<dyn Future<Output = Result<Tuple, Error>> + 'async_trait>>
where T: ToTupleBuffer + ?Sized + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Evaluates and executes the expression in Lua-string, which may be any statement or series of statements. Read more
source§

fn execute<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, sql: &'life1 str, bind_params: &'life2 T, limit: Option<usize> ) -> Pin<Box<dyn Future<Output = Result<Vec<Tuple>, Error>> + 'async_trait>>
where T: ToTupleBuffer + ?Sized + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Execute sql query remotely.
source§

impl Clone for Client

source§

fn clone(&self) -> Client

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Client

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Client

§

impl !Send for Client

§

impl !Sync for Client

§

impl Unpin for Client

§

impl !UnwindSafe for Client

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> IntoClones<(T,)> for T
where T: Clone,

source§

impl<T> IntoClones<(T, T)> for T
where T: Clone,

source§

impl<T> IntoClones<(T, T, T)> for T
where T: Clone,

source§

impl<T> IntoClones<(T, T, T, T)> for T
where T: Clone,

source§

impl<T> IntoClones<(T, T, T, T, T)> for T
where T: Clone,

source§

impl<T> IntoClones<(T, T, T, T, T, T)> for T
where T: Clone,

source§

impl<T> IntoClones<(T, T, T, T, T, T, T)> for T
where T: Clone,

source§

impl<T> IntoClones<(T, T, T, T, T, T, T, T)> for T
where T: Clone,

source§

impl<T> IntoClones<(T, T, T, T, T, T, T, T, T)> for T
where T: Clone,

source§

impl<T> IntoClones<(T, T, T, T, T, T, T, T, T, T)> for T
where T: Clone,

source§

impl<T> IntoClones<(T, T, T, T, T, T, T, T, T, T, T)> for T
where T: Clone,

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.