Struct zenv::Lines [−][src]
pub struct Lines { /* fields omitted */ }
Expand description
Lines
is used to parse the sequence of lines
Zenv
is built on top it. And if you want you can directly use this but don’t :)
Implementations
impl Lines
[src]
impl Lines
[src]pub fn to_hash_map(&self) -> HashMap<String, String>
[src]
pub fn to_hash_map(&self) -> HashMap<String, String>
[src]Parses the lines and converts into a hashmap
Example
use zenv::Lines; const LINES: &str = r#" BASIC=basic QUOTED='quoted' "#; let parsed = Lines::from(LINES).to_hash_map(); assert_eq!(parsed.get("BASIC").unwrap(), &"basic".to_string()); assert_eq!(parsed.get("QUOTED").unwrap(), &"quoted".to_string());
pub fn expand(&self) -> HashMap<String, String>
[src]
pub fn expand(&self) -> HashMap<String, String>
[src]Parses the lines and does variable substitution then converts into a hashmap
Example
use zenv::Lines; const LINES: &str = r#" BASIC=basic EXPANDED="${BASIC}_is_expanded" "#; let parsed = Lines::from(LINES).expand(); assert_eq!(parsed.get("BASIC").unwrap(), &"basic".to_string()); assert_eq!(parsed.get("EXPANDED").unwrap(), &"basic_is_expanded".to_string());