Struct deadpool_redis::Config[][src]

pub struct Config {
    pub url: Option<String>,
    pub connection: Option<ConnectionInfo>,
    pub pool: Option<PoolConfig>,
}
Expand description

Configuration object.

Example (from environment)

By enabling the serde feature you can read the configuration using the config crate as following:

REDIS__CONNECTION__ADDR=redis.example.com
REDIS__POOL__MAX_SIZE=16
REDIS__POOL__TIMEOUTS__WAIT__SECS=2
REDIS__POOL__TIMEOUTS__WAIT__NANOS=0
#[derive(serde::Deserialize)]
struct Config {
    redis: deadpool_redis::Config,
}

impl Config {
    pub fn from_env() -> Result<Self, config::ConfigError> {
        let mut cfg = config::Config::new();
        cfg.merge(config::Environment::new().separator("__")).unwrap();
        cfg.try_into()
    }
}

Fields

url: Option<String>

Redis URL.

See Connection Parameters.

connection: Option<ConnectionInfo>pool: Option<PoolConfig>

Pool configuration.

Implementations

Creates a new Pool using this Config.

Errors

See CreatePoolError for details.

Creates a new PoolBuilder using this Config.

Errors

See ConfigError for details.

Returns deadpool::managed::PoolConfig which can be used to construct a deadpool::managed::Pool instance.

Creates a new Config from the given Redis URL (like redis://127.0.0.1).

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.