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>
impl<N: TcpConnect> ConnectionHandler<N, Resp2>
Sourcepub fn resp2(remote: SocketAddr) -> Self
pub fn resp2(remote: SocketAddr) -> Self
Creates a new connection handler using RESP2 protocol
Source§impl<N: TcpConnect> ConnectionHandler<N, Resp3>
impl<N: TcpConnect> ConnectionHandler<N, Resp3>
Sourcepub fn resp3(remote: SocketAddr) -> Self
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>,
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>,
Sourcepub async fn connect<'a, C: Clock>(
&self,
network: &'a N,
clock: Option<&'a C>,
) -> Result<Client<'a, N::Connection<'a>, C, P>, ConnectionError>
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>,
impl<N: TcpConnect, P: Protocol> ConnectionHandler<N, P>where
HelloCommand: Command<<P as Protocol>::FrameType>,
Sourcepub fn timeout(&mut self, timeout: Microseconds) -> &mut Self
pub fn timeout(&mut self, timeout: Microseconds) -> &mut Self
Sets the max. duration waiting for Redis responses
Sourcepub fn auth(&mut self, credentials: Credentials) -> &mut Self
pub fn auth(&mut self, credentials: Credentials) -> &mut Self
Sets the authentication credentials
Sourcepub fn use_ping(&mut self) -> &mut Self
pub fn use_ping(&mut self) -> &mut Self
Uses a PING command to verify newly created connections
Sourcepub fn memory(&mut self, parameters: MemoryParameters) -> &mut Self
pub fn memory(&mut self, parameters: MemoryParameters) -> &mut Self
Sets memory allocation parameters
Auto Trait Implementations§
impl<N, P> Freeze for ConnectionHandler<N, P>
impl<N, P> RefUnwindSafe for ConnectionHandler<N, P>
impl<N, P> Send for ConnectionHandler<N, P>
impl<N, P> Sync for ConnectionHandler<N, P>
impl<N, P> Unpin for ConnectionHandler<N, P>
impl<N, P> UnsafeUnpin for ConnectionHandler<N, P>
impl<N, P> UnwindSafe for ConnectionHandler<N, P>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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