Skip to content

Commit 394c007

Browse files
rclrs_timer_demo: apply cargo fmt
1 parent b19934a commit 394c007

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

examples/rclrs_timer_demo/src/rclrs_timer_demo.rs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
/// thanks to the spin, which is in charge of executing the timer's events among
44
/// other entities' events.
55
use rclrs::{create_node, Context, Node, RclrsError, Timer};
6-
use std::{
7-
env,
8-
sync::Arc,
9-
time::Duration,
10-
};
6+
use std::{env, sync::Arc, time::Duration};
117

128
/// Contains both the node and timer.
139
struct SimpleTimerNode {
@@ -25,22 +21,17 @@ impl SimpleTimerNode {
2521
fn new(context: &Context, timer_period: Duration) -> Result<Self, RclrsError> {
2622
let node = create_node(context, "simple_timer_node")?;
2723
let mut x = 0;
28-
let timer = node.create_timer_repeating(
29-
timer_period,
30-
move || {
31-
x += 1;
32-
println!(
33-
"Drinking 🧉 for the {x}th time every {:?}.",
34-
timer_period,
35-
);
36-
},
37-
)?;
24+
let timer = node.create_timer_repeating(timer_period, move || {
25+
x += 1;
26+
println!("Drinking 🧉 for the {x}th time every {:?}.", timer_period,);
27+
})?;
3828
Ok(Self { node, timer })
3929
}
4030
}
4131

4232
fn main() -> Result<(), RclrsError> {
4333
let context = Context::new(env::args()).unwrap();
44-
let simple_timer_node = Arc::new(SimpleTimerNode::new(&context, Duration::from_secs(1)).unwrap());
34+
let simple_timer_node =
35+
Arc::new(SimpleTimerNode::new(&context, Duration::from_secs(1)).unwrap());
4536
rclrs::spin(simple_timer_node.node.clone())
4637
}

0 commit comments

Comments
 (0)