Skip to main content

ConnectionHandler

Struct ConnectionHandler 

Source
pub struct ConnectionHandler<N: TcpConnect, P: Protocol>
where HelloCommand: Command<<P as Protocol>::FrameType>,
{ /* private fields */ }
Expand description

Configuration and connection factory for Redis clients.

Each call to connect creates a new connection. The returned client owns the connection, which is closed by the embedded-nal-async implementation when it is dropped.

Implementations§

Source§

impl<N: TcpConnect> ConnectionHandler<N, Resp2>

Source

pub fn resp2(remote: SocketAddr) -> Self

Creates a new connection handler using RESP2 protocol

Source§

impl<N: TcpConnect> ConnectionHandler<N, Resp3>

Source

pub fn resp3(remote: SocketAddr) -> Self

Creates a new connection handler using RESP3 protocol

Source§

impl<N: TcpConnect, P: Protocol> ConnectionHandler<N, P>
where AuthCommand: Command<<P as Protocol>::FrameType>, HelloCommand: Command<<P as Protocol>::FrameType>, PingCommand: Command<<P as Protocol>::FrameType>, <P as Protocol>::FrameType: ToStringOption + From<CommandBuilder>,

Source

pub async fn connect<'a, C: Clock>( &self, network: &'a N, clock: Option<&'a C>, ) -> Result<Client<'a, N::Connection<'a>, C, P>, ConnectionError>

Opens, authenticates and returns a Redis client.

Source§

impl<N: TcpConnect, P: Protocol> ConnectionHandler<N, P>
where HelloCommand: Command<<P as Protocol>::FrameType>,

Source

pub fn timeout(&mut self, timeout: Microseconds) -> &mut Self

Sets the max. duration waiting for Redis responses

Source

pub fn auth(&mut self, credentials: Credentials) -> &mut Self

Sets the authentication credentials

Source

pub fn use_ping(&mut self) -> &mut Self

Uses a PING command to verify newly created connections

Source

pub fn memory(&mut self, parameters: MemoryParameters) -> &mut Self

Sets memory allocation parameters

Auto Trait Implementations§

§

impl<N, P> Freeze for ConnectionHandler<N, P>
where P: Freeze, PhantomData<N>: Freeze,

§

impl<N, P> RefUnwindSafe for ConnectionHandler<N, P>

§

impl<N, P> Send for ConnectionHandler<N, P>
where P: Send, PhantomData<N>: Send,

§

impl<N, P> Sync for ConnectionHandler<N, P>
where P: Sync, PhantomData<N>: Sync,

§

impl<N, P> Unpin for ConnectionHandler<N, P>
where P: Unpin, PhantomData<N>: Unpin,

§

impl<N, P> UnsafeUnpin for ConnectionHandler<N, P>

§

impl<N, P> UnwindSafe for ConnectionHandler<N, P>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.