Skip to main content

Crate envfury

Crate envfury 

Source
Expand description

§envfury

A collection of utilities for procedural reading of the process environment variables.

Structs§

Error
Error from reading the env var.

Enums§

MustError
Error while processing a required variable.
OrElseTryError
Error while processing a variable or executing a fallible else.
OrParseError
Error while processing a variable or parsing it’s default.
OrTryIntoError
Error while processing a variable or executing a TryInto::try_into.
ValueError
Error while processing the value.

Functions§

maybe
Get the value of environment variable key and parse it into the type T if variable is set. If the variable is not set - returns None. Returns an error if the value is invalid Unicode or if the value could not be parsed.
must
Get the value of environment variable key and parse it into the type T if variable is set. Returns an error if the value is not set, is invalid Unicode or if the value could not be parsed.
or
Get the value of environment variable key and parse it into the type T if variable is set. If the variable is not set - returns the default argument. Returns an error if the value is invalid Unicode or if the value could not be parsed.
or_default
Get the value of environment variable key and parse it into the type T if variable is set. If the variable is not set - returns a newly constructed value via the Default trait. Returns an error if the value is invalid Unicode or if the value could not be parsed.
or_else
Get the value of environment variable key and parse it into the type T if variable is set. If the variable is not set - returns the result of calling the f argument. Returns an error if the value is invalid Unicode or if the value could not be parsed.
or_else_try
Get the value of environment variable key and parse it into the type T if variable is set. If the variable is not set - returns the Ok-result of calling the f argument. Returns an error if the variable value is invalid Unicode, if the value could not be parsed, or if calling f resulted in an error.
or_into
Get the value of environment variable key and parse it into the type T if variable is set. If the variable is not set - returns the result of calling .into() on the default argument. Returns an error if the value is invalid Unicode or if the value could not be parsed.
or_parse
Get the value of environment variable key and parse it into the type T if variable is set. If the variable is not set - returns the result of calling the default and parsing the default argument. Returns an error if the variable value is invalid Unicode, if the value could not be parsed, or if the default could not be parsed.
or_try_into
Get the value of environment variable key and parse it into the type T if variable is set. If the variable is not set - returns the Ok-result of calling .try_into() on the default argument. Returns an error if the variable value is invalid Unicode, if the value could not be parsed, or if the default could not be parsed.