pub struct Env;Expand description
Parser for the env format: dotenv / env-file KEY=VALUE lines into a string map.
Skips blank lines and # comments, supports quoted values, and records each key’s line number
as a Location. When the source carries a separator option, keys are nested into
sub-maps. Stateless — construct with Env::new.
use tanzim_parse::{Parse, env::Env};
use tanzim_source::SourceBuilder;
let source = SourceBuilder::new()
.with_source("file")
.with_resource(".env")
.build()
.unwrap();
let value = Env::new()
.parse(&source, b"# comment\nPORT=8080\n")
.unwrap();
let port = value.value.as_map().unwrap().get("port").unwrap();
assert_eq!(port.value.as_string().unwrap(), "8080");Implementations§
Trait Implementations§
impl Copy for Env
Auto Trait Implementations§
impl Freeze for Env
impl RefUnwindSafe for Env
impl Send for Env
impl Sync for Env
impl Unpin for Env
impl UnsafeUnpin for Env
impl UnwindSafe for Env
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more