difftreelog
fix Allow = characters in tla-code
in: master
1 file changed
crates/jrsonnet-cli/src/stdlib.rsdiffbeforeafterboth13impl FromStr for ExtStr {13impl FromStr for ExtStr {14 type Err = &'static str;14 type Err = &'static str;15 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {15 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {16 let out: Vec<_> = s.split('=').collect();17 match out.len() {16 match s.find('=') {18 1 => Ok(ExtStr {17 Some(idx) => Ok(ExtStr {19 name: out[0].to_owned(),18 name: s[..idx].to_owned(),20 value: std::env::var(out[0]).or(Err("missing env var"))?,19 value: s[idx + 1..].to_owned(),21 }),20 }),22 2 => Ok(ExtStr {21 None => Ok(ExtStr {23 name: out[0].to_owned(),22 name: s.to_owned(),24 value: out[1].to_owned(),23 value: std::env::var(s).or(Err("missing env var"))?,25 }),24 }),2627 _ => Err("bad ext-str syntax"),28 }25 }29 }26 }30}27}