Crate easyenv

source ·
Expand description

Very simple helper functions for environment variables and environment variable-driven env_logger configuration.

Enums

Constants

  • Name of the environment variable Rust’s env logger uses

Functions

  • Get an environment variable as a bool. If not present or there is an error in parsing, return None.
  • Get an environment variable as a bool, or fall back to the provided default. Returns the default in the event of a parse error.
  • Get an environment variable as a bool. If not provided or cannot parse, return an error.
  • Get an environment variable as a Duration in seconds. If not present or there is an error in parsing, return None.
  • Get an environment variable as a Duration in seconds, or fall back to the provided default. Returns the default in the event of a parse error.
  • Get an environment variable as a Duration in seconds. If not provided or cannot parse, return an error.
  • Get an environment variable as a number, or fall back to the provided default if not set. If the env var is present but can’t be parsed, an error is returned instead.
  • Get an environment variable as a PathBuf. If not present or there is an error in parsing, return None.
  • Get an environment variable as a PathBuf, or fall back to the provided default. Returns the default in the event of a parse error.
  • Get an environment variable as a PathBuf. If not provided or cannot parse, return an error.
  • Get an environment variable as an optional String.
  • Get an environment variable as a String, or fall back to the provided default.
  • Get an environment variable as a String, or return an error.
  • Initialize dotenv and env logger. See init_dotenv() and init_env_logger(Option<&str>) for further details.
  • Initialize dotenv with the default .env config file.
  • Initialize Rust’s env logger.