pub struct AsyncConnectionConfig { /* private fields */ }Expand description
Options for creation of async connection
Implementations§
Source§impl AsyncConnectionConfig
impl AsyncConnectionConfig
Sourcepub fn set_connection_timeout(
self,
connection_timeout: Option<Duration>,
) -> Self
pub fn set_connection_timeout( self, connection_timeout: Option<Duration>, ) -> Self
Each connection attempt to the server will time out after connection_timeout.
Set None if you don’t want the connection attempt to time out.
Sourcepub fn set_response_timeout(self, response_timeout: Option<Duration>) -> Self
pub fn set_response_timeout(self, response_timeout: Option<Duration>) -> Self
The new connection will time out operations after response_timeout has passed.
Set None if you don’t want requests to time out.
Sourcepub fn set_push_sender(self, sender: impl AsyncPushSender) -> Self
pub fn set_push_sender(self, sender: impl AsyncPushSender) -> Self
Sets sender sender for push values.
The sender can be a channel, or an arbitrary function that handles crate::PushInfo values. This will fail client creation if the connection isn’t configured for RESP3 communications via the crate::RedisConnectionInfo::set_protocol function.
§Examples
let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel();
let config = AsyncConnectionConfig::new().set_push_sender(tx);let messages = Arc::new(Mutex::new(Vec::new()));
let config = AsyncConnectionConfig::new().set_push_sender(move |msg|{
let Ok(mut messages) = messages.lock() else {
return Err(redis::aio::SendError);
};
messages.push(msg);
Ok(())
});Sourcepub fn set_dns_resolver(self, dns_resolver: impl AsyncDNSResolver) -> Self
pub fn set_dns_resolver(self, dns_resolver: impl AsyncDNSResolver) -> Self
Set the DNS resolver for the underlying TCP connection.
The parameter resolver must implement the crate::io::AsyncDNSResolver trait.
Trait Implementations§
Source§impl Clone for AsyncConnectionConfig
impl Clone for AsyncConnectionConfig
Source§fn clone(&self) -> AsyncConnectionConfig
fn clone(&self) -> AsyncConnectionConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AsyncConnectionConfig
impl !RefUnwindSafe for AsyncConnectionConfig
impl Send for AsyncConnectionConfig
impl Sync for AsyncConnectionConfig
impl Unpin for AsyncConnectionConfig
impl !UnwindSafe for AsyncConnectionConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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