From 1899b27b791734a6b72e28cfb1420536c6035ee4 Mon Sep 17 00:00:00 2001 From: troido Date: Thu, 21 May 2020 15:26:12 +0200 Subject: added exchanger as seperate component/system; refactored other interactions; parameter parsing returns result instead of option --- src/componentwrapper.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/componentwrapper.rs') 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, Vec)>) { + Exchanger { + prefix, + exchanges: exchanges + .into_iter() + .map(|(key, cost, offer)| + (key, Exchange{cost, offer}) + ) + .collect() + } + }; ); -- cgit