Hi!
I've got
- Unknown amount of environment variables to read/check
- They are all supposed to follow the structure of comma-separated strings (e.g.
a,b,c,d|a|a,b) - So I imagine they could be represented as either
[env::var(ENV_VAR_X), env::var(ENV_VAR_Y), ...]or equivalently as[Ok("a,b"), Ok("c,d), Ok(<some string>), Err(<env var not found>), ...]"
Finally, I want to
A. Report to stderr for each missing env-var (any resulting <Result::Err>)
B. Collate all the comma-separated values across all env vars into an (owned) string of form FOOBAR!={},FOOBAR!={}, for each element collated.
BONUS POINTS: Remove duplicate elements (as in a HashSet).
BONUS POINTS(2): Make it a chain of iterators, instead of for-loops.
I keep struggling w/the borrow checker. I understand that .split(",") returns &str, but I have not yet figured out/understood how to combine goals A and B =/