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: Duration) -> Self
pub fn set_connection_timeout(self, connection_timeout: Duration) -> Self
Sets the connection timeout
Sourcepub fn set_response_timeout(self, response_timeout: Duration) -> Self
pub fn set_response_timeout(self, response_timeout: Duration) -> Self
Sets the response timeout
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::protocol field.
§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_tcp_settings(self, tcp_settings: TcpSettings) -> Self
pub fn set_tcp_settings(self, tcp_settings: TcpSettings) -> Self
Set the behavior of the underlying TCP connection.
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::aio::DNSResolver
] trait.
Trait Implementations§
Source§impl Clone for AsyncConnectionConfig
impl Clone for AsyncConnectionConfig
Source§fn clone(&self) -> AsyncConnectionConfig
fn clone(&self) -> AsyncConnectionConfig
Returns a copy 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 moreSource§impl Default for AsyncConnectionConfig
impl Default for AsyncConnectionConfig
Source§fn default() -> AsyncConnectionConfig
fn default() -> AsyncConnectionConfig
Returns the “default value” for a type. Read more
Auto 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