pub struct Environment { /* private fields */ }

Implementations

Create a new environment configuration which will prefix keys with the given prefix and an underscore (e.g. prefix = “foo” => “foo_*”). An empty prefix will not prepend anything.

Getting a value from the environment will try to make the key more environment-variable-like . ‘.’ and ‘/’ are replaced with ‘_’ and everything is upper-cased. If the prefix is ‘foo’, then a get for ‘my.app.secret’ would look for ‘FOO_MY_APP_SECRET’.

Trait Implementations

Get a value from the environment using the given key. ‘.’ and ‘/’ are replaced with ‘_’ and everything is upper-cased. If the prefix is ‘foo’, then a get for ‘my.app.secret’ would look for ‘FOO_MY_APP_SECRET’.

Similar to get but panics if there is no value.

Get the value as a string or panics if one isn’t found.

Get the value as an integer or panics if one isn’t found or cannot be parsed. Read more

Get the value as a float or panics if one isn’t found or cannot be parsed. Read more

Get the value as a bool or panics if one isn’t found or cannot be parsed. The following case-insensitive values are considered true: t, true, 1, y, yes. All other values are considered false. Read more

Get the value as a duration or panics if one isn’t found or can’t be parsed. Thre doesn’t appear to be a parsing function for a duration, so it attempts to convert to an integer and use that as the number of seconds. Read more

Get the value as a duration or panics if one isn’t found or it can’t be parsed. It uses RFC339 to parse it. Read more

Get a list or panics if one isn’t found. The list should be a comma-delimited list surrouned by brackets (e.g. [1, 2, 3] => vec![“1”, “2”, “3”]. Read more

Get a map or panics if one isn’t found. The list should be a comma-delimited list surrouned by braces with key/value pairs associated with => (e.g. {a=>1, b=>2, c=>3} => ((a,1), (b,2), (c,3))). Read more

Formats the value using the given formatter. 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

Returns the argument unchanged.

Calls U::from(self).

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

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.