pub struct ClusterConfig { /* private fields */ }
Available on crate feature
cluster
only.Expand description
Options for creation of connection
Implementations§
Source§impl ClusterConfig
impl ClusterConfig
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 a sender to receive pushed 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 = ClusterConfig::new().set_push_sender(tx);
let messages = Arc::new(Mutex::new(Vec::new()));
let config = ClusterConfig::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, resolver: impl AsyncDNSResolver) -> Self
pub fn set_dns_resolver(self, resolver: impl AsyncDNSResolver) -> Self
Set asynchronous DNS resolver for the underlying TCP connection.
The parameter resolver must implement the crate::io::AsyncDNSResolver
trait.
Trait Implementations§
Source§impl Clone for ClusterConfig
impl Clone for ClusterConfig
Source§fn clone(&self) -> ClusterConfig
fn clone(&self) -> ClusterConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for ClusterConfig
impl Default for ClusterConfig
Source§fn default() -> ClusterConfig
fn default() -> ClusterConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ClusterConfig
impl !RefUnwindSafe for ClusterConfig
impl Send for ClusterConfig
impl Sync for ClusterConfig
impl Unpin for ClusterConfig
impl !UnwindSafe for ClusterConfig
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