diff options
| author | troido <troido@protonmail.com> | 2020-04-03 11:22:04 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-04-03 11:22:04 +0200 |
| commit | 0702ea943b801176649fee860715fed0f5348c8d (patch) | |
| tree | 6e13028e79683c325c41d125921c0fe9a22d3386 /src/componentwrapper.rs | |
| parent | b597d2279db7beb0d619fac472481b7f707609c8 (diff) | |
allow lists as parameter types, sacrificing some type safety for expressability
Diffstat (limited to 'src/componentwrapper.rs')
| -rw-r--r-- | src/componentwrapper.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/componentwrapper.rs b/src/componentwrapper.rs index 898ab1b..0fb46d0 100644 --- a/src/componentwrapper.rs +++ b/src/componentwrapper.rs @@ -202,11 +202,17 @@ components!( }; Equipment () {panic!("equipment from parameters not implemented")}; CreationTime (time: Int) {CreationTime{time: Timestamp(time)}}; - Flags (flags: Strings) { + Flags (flags: List) { Flags( flags .iter() - .map(|f| Flag::from_str(f)) + .map(|param| { + if let Parameter::String(f) = param { + Flag::from_str(f) + } else { + None + } + }) .collect::<Option<HashSet<Flag>>>().ok_or(aerr!("invalid flag name"))? ) }; |
