logo
pub struct BasicSettings<A> {
    pub actix: ActixSettings,
    pub application: A,
}
Expand description

Wrapper for server and application-specific settings.

Fields

actix: ActixSettings

Actix Web server settings.

application: A

Application-specific settings.

Implementations

Parse an instance of Self from a TOML file located at filepath.

If the file doesn’t exist, it is generated from the default TOML template, after which the newly generated file is read in and parsed.

Parse an instance of Self straight from the default TOML template.

Parse an instance of Self straight from the default TOML template.

Writes the default TOML template to a new file, located at filepath.

Errors

Returns a FileExists error if a file already exists at that location.

Attempts to parse value and override the referenced field.

Examples
use actix_settings::{Settings, Mode};

let mut settings = Settings::from_default_template()?;
assert_eq!(settings.actix.mode, Mode::Development);

Settings::override_field(&mut settings.actix.mode, "production")?;
assert_eq!(settings.actix.mode, Mode::Production);

Attempts to read an environment variable, parse it, and override the referenced field.

Examples
use actix_settings::{Settings, Mode};

std::env::set_var("OVERRIDE__MODE", "production");

let mut settings = Settings::from_default_template()?;
assert_eq!(settings.actix.mode, Mode::Development);

Settings::override_field_with_env_var(&mut settings.actix.mode, "OVERRIDE__MODE")?;
assert_eq!(settings.actix.mode, Mode::Production);

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

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

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

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more