Skip to content

Commit 362da99

Browse files
authored
Merge pull request #658 from swimos/box_local
Renames HandlerActionExt::boxed to boxed_local and adds HandlerActionExt::boxed
2 parents 4dafa30 + bf5fe77 commit 362da99

File tree

28 files changed

+190
-149
lines changed

28 files changed

+190
-149
lines changed

example_apps/aggregations/src/area.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,10 @@ impl AreaLifecycle {
140140
format!("/cars/{car_id}").as_str(),
141141
"speed",
142142
)
143-
.boxed(),
144-
Action::Deregister(car_id) => context.remove_downlink(AreaAgent::CARS, *car_id).boxed(),
143+
.boxed_local(),
144+
Action::Deregister(car_id) => context
145+
.remove_downlink(AreaAgent::CARS, *car_id)
146+
.boxed_local(),
145147
}
146148
}
147149
#[on_update(cars)]

example_apps/command_lane/src/agent.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ impl ExampleLifecycle {
7676
cmd: &Instruction,
7777
) -> impl EventHandler<ExampleAgent> {
7878
match *cmd {
79-
Instruction::Zero => context.set_value(ExampleAgent::LANE, 0).boxed(),
79+
Instruction::Zero => context.set_value(ExampleAgent::LANE, 0).boxed_local(),
8080
Instruction::Add(n) => context
8181
.get_value(ExampleAgent::LANE)
8282
.and_then(move |v| context.set_value(ExampleAgent::LANE, v + n))
83-
.boxed(),
84-
Instruction::Stop => context.stop().boxed(),
83+
.boxed_local(),
84+
Instruction::Stop => context.stop().boxed_local(),
8585
}
8686
}
8787
}

example_apps/event_downlink/src/consumer/agent.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ impl ConsumerLifecycle {
101101
),
102102
})
103103
.discard()
104-
.boxed(),
104+
.boxed_local(),
105105
Instruction::CloseLink => handle
106106
.with_mut(|h| {
107107
if let Some(h) = h.as_mut() {
108108
h.stop();
109109
}
110110
})
111-
.boxed(),
112-
Instruction::Stop => context.stop().boxed(),
111+
.boxed_local(),
112+
Instruction::Stop => context.stop().boxed_local(),
113113
};
114114
context
115115
.effect(move || println!("{}", msg))

example_apps/local_downlink/src/consumer/agent.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ impl ConsumerLifecycle {
9898
),
9999
})
100100
.discard()
101-
.boxed(),
101+
.boxed_local(),
102102
Instruction::CloseLink => handle
103103
.with_mut(|h| {
104104
if let Some(h) = h.as_mut() {
105105
h.stop();
106106
}
107107
})
108-
.boxed(),
108+
.boxed_local(),
109109
Instruction::Send(n) => handle
110110
.with_mut(move |maybe| {
111111
if let Some(handle) = maybe.as_mut() {
@@ -114,8 +114,8 @@ impl ConsumerLifecycle {
114114
}
115115
}
116116
})
117-
.boxed(),
118-
Instruction::Stop => context.stop().boxed(),
117+
.boxed_local(),
118+
Instruction::Stop => context.stop().boxed_local(),
119119
};
120120
context
121121
.effect(move || println!("{}", msg))

example_apps/map_downlink/src/consumer/agent.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ impl ConsumerLifecycle {
105105
),
106106
})
107107
.discard()
108-
.boxed(),
108+
.boxed_local(),
109109
Instruction::CloseLink => handle
110110
.with_mut(|h| {
111111
if let Some(h) = h.as_mut() {
112112
h.stop();
113113
}
114114
})
115-
.boxed(),
115+
.boxed_local(),
116116
Instruction::Send(n) => handle
117117
.with_mut(move |h| {
118118
if let Some(handle) = h.as_mut() {
@@ -121,8 +121,8 @@ impl ConsumerLifecycle {
121121
}
122122
}
123123
})
124-
.boxed(),
125-
Instruction::Stop => context.stop().boxed(),
124+
.boxed_local(),
125+
Instruction::Stop => context.stop().boxed_local(),
126126
};
127127
context
128128
.effect(move || println!("{}", msg))

example_apps/map_store/src/agent.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ impl ExampleLifecycle {
8585
context
8686
.get_value(ExampleAgent::LANE)
8787
.and_then(move |v| context.update(ExampleAgent::SAVED, key, v))
88-
.boxed()
88+
.boxed_local()
8989
}
9090
Instruction::Restore(name) => {
9191
let key = name.clone();
9292
context
9393
.get_entry(ExampleAgent::SAVED, key)
9494
.map(|maybe: Option<i32>| maybe.unwrap_or_default())
9595
.and_then(move |v| context.set_value(ExampleAgent::LANE, v))
96-
.boxed()
96+
.boxed_local()
9797
}
9898
}
9999
}

example_apps/map_store_persistence/src/agent.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ impl ExampleLifecycle {
8989
cmd: &Instruction,
9090
) -> impl EventHandler<ExampleAgent> {
9191
match cmd {
92-
Instruction::Wake => UnitHandler::default().boxed(),
92+
Instruction::Wake => UnitHandler::default().boxed_local(),
9393
Instruction::SetValue { key, value } => context
9494
.update(ExampleAgent::VALUE, key.clone(), *value)
95-
.boxed(),
95+
.boxed_local(),
9696
Instruction::SetTemp { key, value } => context
9797
.update(ExampleAgent::TEMPORARY, key.clone(), *value)
98-
.boxed(),
99-
Instruction::Stop => context.stop().boxed(),
98+
.boxed_local(),
99+
Instruction::Stop => context.stop().boxed_local(),
100100
}
101101
}
102102
}

example_apps/value_downlink/src/consumer/agent.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ impl ConsumerLifecycle {
101101
),
102102
})
103103
.discard()
104-
.boxed(),
104+
.boxed_local(),
105105
Instruction::CloseLink => handle
106106
.with_mut(|h| {
107107
if let Some(h) = h.as_mut() {
108108
h.stop();
109109
}
110110
})
111-
.boxed(),
111+
.boxed_local(),
112112
Instruction::Send(n) => handle
113113
.with_mut(move |maybe| {
114114
if let Some(handle) = maybe.as_mut() {
@@ -117,8 +117,8 @@ impl ConsumerLifecycle {
117117
}
118118
}
119119
})
120-
.boxed(),
121-
Instruction::Stop => context.stop().boxed(),
120+
.boxed_local(),
121+
Instruction::Stop => context.stop().boxed_local(),
122122
};
123123
context
124124
.effect(move || println!("{}", msg))

example_apps/value_store/src/agent.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ impl ExampleLifecycle {
8383
Instruction::Save => context
8484
.get_value(ExampleAgent::LANE)
8585
.and_then(move |v| context.set_value(ExampleAgent::SAVED, v))
86-
.boxed(),
86+
.boxed_local(),
8787
Instruction::Restore => context
8888
.get_value(ExampleAgent::SAVED)
8989
.and_then(move |v| context.set_value(ExampleAgent::LANE, v))
90-
.boxed(),
90+
.boxed_local(),
9191
}
9292
}
9393
}

example_apps/value_store_persistence/src/agent.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ impl ExampleLifecycle {
8484
cmd: &Instruction,
8585
) -> impl EventHandler<ExampleAgent> {
8686
match *cmd {
87-
Instruction::Wake => UnitHandler::default().boxed(),
88-
Instruction::SetValue(n) => context.set_value(ExampleAgent::VALUE, n).boxed(),
89-
Instruction::SetTemp(n) => context.set_value(ExampleAgent::TEMPORARY, n).boxed(),
90-
Instruction::Stop => context.stop().boxed(),
87+
Instruction::Wake => UnitHandler::default().boxed_local(),
88+
Instruction::SetValue(n) => context.set_value(ExampleAgent::VALUE, n).boxed_local(),
89+
Instruction::SetTemp(n) => context.set_value(ExampleAgent::TEMPORARY, n).boxed_local(),
90+
Instruction::Stop => context.stop().boxed_local(),
9191
}
9292
}
9393
}

0 commit comments

Comments
 (0)