Skip to content

env

Dotenv (.env) helpers working on plain text: no file or process-environment access, so they are deterministic and easy to test. Read the file yourself, edit the content here, and write it back.

Cargo feature env (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features env

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.5", default-features = false, features = ["env"] }

Import path: helpers4::env.

ItemWhat it does
getReturns the value of key in dotenv content, or None when it is not assigned.
parseParses dotenv content into (key, value) pairs, in file order.
removeRemoves every assignment of key from dotenv content and returns the new content.
setSets key to value in dotenv content and returns the new content.

Documented on the page of the helper that returns them.

TypeReturned by
InvalidKeyErrorset