Config

Struct Config 

Source
pub struct Config {
Show 14 fields pub server: ServerConfig, pub username: Option<String>, pub password: Option<String>, pub database: usize, pub tls_config: Option<TlsConfig>, pub connect_timeout: Duration, pub command_timeout: Duration, pub auto_resubscribe: bool, pub auto_remonitor: bool, pub connection_name: String, pub keep_alive: Option<Duration>, pub no_delay: bool, pub retry_on_error: bool, pub reconnection: ReconnectionConfig,
}
Expand description

Configuration options for a client or a pooled client

Fields§

§server: ServerConfig

Connection server configuration (standalone, sentinel, or cluster)

§username: Option<String>

An optional ACL username for authentication.

See ACL

§password: Option<String>

An optional password for authentication.

The password could be either coupled with an ACL username either used alone.

See:

§database: usize

The default database for this connection.

If database is not set to 0, a SELECT command will be automatically issued at connection or reconnection.

§tls_config: Option<TlsConfig>
Available on crate features native-tls or rustls only.

An optional TLS configuration.

§connect_timeout: Duration

The time to attempt a connection before timing out. The default is 10 seconds

§command_timeout: Duration

If a command does not return a reply within a set number of milliseconds, a timeout error will be thrown.

If set to 0, no timeout is apply

The default is 0

§auto_resubscribe: bool

When the client reconnects, channels subscribed in the previous connection will be resubscribed automatically if auto_resubscribe is true.

The default is true

§auto_remonitor: bool

When the client reconnects, if in monitor mode, the monitor command will be resent automatically

The default is true

§connection_name: String

Set the name of the connection to make it easier to identity the connection in client list.

See client_setname

§keep_alive: Option<Duration>

Enable/disable keep-alive functionality (default None)

See TcpKeepAlive::with_time

§no_delay: bool

Enable/disable the use of Nagle’s algorithm (default true)

See TcpStream::set_nodelay

§retry_on_error: bool

Defines the default strategy for retries on network error (default false):

  • true - retry sending the command/batch of commands on network error
  • false - do not retry sending the command/batch of commands on network error

This strategy can be overriden for each command/batch of commands in the following functions:

§reconnection: ReconnectionConfig

Reconnection policy configuration (Constant, Linear or Exponential)

Implementations§

Source§

impl Config

Source

pub fn from_uri(uri: Url) -> Result<Config>

Build a config from an URI in the format redis[s]://[[username]:password@]host[:port]/[database]

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for Config

Source§

fn from_str(str: &str) -> Result<Config>

Build a config from an URI or a standard address format host:port

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

impl IntoConfig for Config

Source§

fn into_config(self) -> Result<Config>

Converts this type into a Config.

Auto Trait Implementations§

§

impl Freeze for Config

§

impl !RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl !UnwindSafe for Config

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V