diff options
| author | troido <troido@protonmail.com> | 2020-05-21 15:26:12 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-06-05 22:27:54 +0200 |
| commit | 1899b27b791734a6b72e28cfb1420536c6035ee4 (patch) | |
| tree | cbb908f05c1daa1c9fb996d474a34f0b6f4aba76 /src/componentwrapper.rs | |
| parent | f47034bdf86e7ddc831ecb8f50689b9b07a0f6ca (diff) | |
added exchanger as seperate component/system; refactored other interactions; parameter parsing returns result instead of option
Diffstat (limited to 'src/componentwrapper.rs')
| -rw-r--r-- | src/componentwrapper.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/componentwrapper.rs b/src/componentwrapper.rs index e1b5bb8..638d156 100644 --- a/src/componentwrapper.rs +++ b/src/componentwrapper.rs @@ -21,6 +21,7 @@ use crate::{ fromtoparameter::FromToParameter, Timestamp, Template, + exchange::Exchange, Pos, Result, aerr @@ -235,6 +236,17 @@ components!(all: }; Substitute (into: Template); Talkable (text: String); + Exchanger (prefix: String, exchanges: Vec<(String, Vec<ItemId>, Vec<ItemId>)>) { + Exchanger { + prefix, + exchanges: exchanges + .into_iter() + .map(|(key, cost, offer)| + (key, Exchange{cost, offer}) + ) + .collect() + } + }; ); |
