Struct Env

pub struct Env<'a> { /* private fields */ }

Set of environment variables to configure from.

Default environment variables

By default, the Env will read the following environment variables:

These sources can be configured using the builder methods on Env.

Implementations

impl<'a> Env<'a>

fn new() -> Self

Get a default set of environment variables.

fn filter<E>(self, filter_env: E) -> Self
where
    E: Into<Cow<'a, str>>,

Specify an environment variable to read the filter from.

fn filter_or<E, V>(self, filter_env: E, default: V) -> Self
where
    E: Into<Cow<'a, str>>,
    V: Into<Cow<'a, str>>,

Specify an environment variable to read the filter from.

If the variable is not set, the default value will be used.

fn default_filter_or<V>(self, default: V) -> Self
where
    V: Into<Cow<'a, str>>,

Use the default environment variable to read the filter from.

If the variable is not set, the default value will be used.

fn write_style<E>(self, write_style_env: E) -> Self
where
    E: Into<Cow<'a, str>>,

Specify an environment variable to read the style from.

fn write_style_or<E, V>(self, write_style_env: E, default: V) -> Self
where
    E: Into<Cow<'a, str>>,
    V: Into<Cow<'a, str>>,

Specify an environment variable to read the style from.

If the variable is not set, the default value will be used.

fn default_write_style_or<V>(self, default: V) -> Self
where
    V: Into<Cow<'a, str>>,

Use the default environment variable to read the style from.

If the variable is not set, the default value will be used.

Trait Implementations

impl Default for Env<'_>

fn default() -> Self

impl<'a> Debug for Env<'a>

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

impl<'a, T> From<T> for Env<'a> where T: Into<Cow<'a, str>>,

fn from(filter_env: T) -> Self

Auto Trait Implementations

impl<'a> Freeze for Env<'a>

impl<'a> RefUnwindSafe for Env<'a>

impl<'a> Send for Env<'a>

impl<'a> Sync for Env<'a>

impl<'a> Unpin for Env<'a>

impl<'a> UnsafeUnpin for Env<'a>

impl<'a> UnwindSafe for Env<'a>

Blanket Implementations

impl<T> Any for Env<'a> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Env<'a> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Env<'a> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for Env<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for Env<'a> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom<U> for Env<'a> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Env<'a> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>