git.delta.rocks / jrsonnet / refs/commits / 9872fc296cec

difftreelog

test for = character in tla body

expelledboy2023-06-20parent: #79e339a.patch.diff
in: master

1 file changed

modifiedcrates/jrsonnet-cli/src/stdlib.rsdiffbeforeafterboth
10 pub value: String,10 pub value: String,
11}11}
1212
13/// Parses a string like `name=<value>`, or `name` and reads value from env variable.
14/// With no value it will be read from env variable.
15/// If env variable is not found then it will be an error.
16/// Value can contain `=` symbol.
17///
18/// ```
19/// use std::str::FromStr;
20/// use jrsonnet_cli::ExtStr;
21///
22/// let ext = ExtStr::from_str("name=value").unwrap();
23/// assert_eq!(ext.name, "name");
24/// assert_eq!(ext.value, "value");
25///
26/// std::env::set_var("name", "value");
27///
28/// let ext = ExtStr::from_str("name").unwrap();
29/// assert_eq!(ext.name, "name");
30/// assert_eq!(ext.value, "value");
31///
32/// let ext = ExtStr::from_str("name=value=with=equals").unwrap();
33/// assert_eq!(ext.name, "name");
34/// assert_eq!(ext.value, "value=with=equals");
35/// ```
36///
13impl FromStr for ExtStr {37impl FromStr for ExtStr {
14 type Err = &'static str;38 type Err = &'static str;
39