removed f variable, to fix
This commit is contained in:
parent
76e95f2859
commit
d6cd0f1f20
@ -119,11 +119,15 @@ impl EventDispatcher {
|
|||||||
F: Fn(&Event, &PairStatus) -> Fut,
|
F: Fn(&Event, &PairStatus) -> Fut,
|
||||||
Fut: Future<Output = ()> + Send,
|
Fut: Future<Output = ()> + Send,
|
||||||
{
|
{
|
||||||
let f = Box::new(move |e, s| tokio::spawn(f(&e, s)));
|
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
EventKind::Any => self.on_any_event_handlers.push(f),
|
EventKind::Any => self
|
||||||
_ => self.event_handlers.entry(event).or_default().push(f),
|
.on_any_event_handlers
|
||||||
|
.push(Box::new(move |e, s| tokio::spawn(f(&e, s)))),
|
||||||
|
_ => self
|
||||||
|
.event_handlers
|
||||||
|
.entry(event)
|
||||||
|
.or_default()
|
||||||
|
.push(Box::new(move |e, s| tokio::spawn(f(&e, s)))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,15 +139,15 @@ impl EventDispatcher {
|
|||||||
F: Fn(&PositionWrapper, &PairStatus) -> Fut,
|
F: Fn(&PositionWrapper, &PairStatus) -> Fut,
|
||||||
Fut: Future<Output = ()> + Send,
|
Fut: Future<Output = ()> + Send,
|
||||||
{
|
{
|
||||||
let f = Box::new(move |pw, s| tokio::spawn(f(&pw, s)));
|
|
||||||
|
|
||||||
match state {
|
match state {
|
||||||
PositionState::Any => self.on_any_position_state_handlers.push(f),
|
PositionState::Any => self
|
||||||
|
.on_any_position_state_handlers
|
||||||
|
.push(Box::new(move |pw, s| tokio::spawn(f(&pw, s)))),
|
||||||
_ => self
|
_ => self
|
||||||
.position_state_handlers
|
.position_state_handlers
|
||||||
.entry(state)
|
.entry(state)
|
||||||
.or_default()
|
.or_default()
|
||||||
.push(f),
|
.push(Box::new(move |pw, s| tokio::spawn(f(&pw, s)))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ pub enum PositionState {
|
|||||||
impl PositionState {
|
impl PositionState {
|
||||||
fn color(self) -> String {
|
fn color(self) -> String {
|
||||||
match self {
|
match self {
|
||||||
|
PositionState::Any => "blue",
|
||||||
PositionState::Critical | PositionState::Loss => "red",
|
PositionState::Critical | PositionState::Loss => "red",
|
||||||
PositionState::BreakEven => "yellow",
|
PositionState::BreakEven => "yellow",
|
||||||
PositionState::MinimumProfit | PositionState::Profit => "green",
|
PositionState::MinimumProfit | PositionState::Profit => "green",
|
||||||
|
Loading…
Reference in New Issue
Block a user