|
21 | 21 | //! Code that needs work confined to spinning should put it in an entity callback |
22 | 22 | //! rather than a spawned task. |
23 | 23 |
|
24 | | -use std::any::Any; |
25 | | -use std::collections::HashMap; |
26 | | -use std::panic::AssertUnwindSafe; |
27 | | -use std::sync::{ |
28 | | - atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering}, |
29 | | - Arc, Mutex, |
| 24 | +use std::{ |
| 25 | + any::Any, |
| 26 | + collections::HashMap, |
| 27 | + panic::AssertUnwindSafe, |
| 28 | + sync::{ |
| 29 | + atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering}, |
| 30 | + Arc, Mutex, |
| 31 | + }, |
| 32 | + time::{Duration, Instant}, |
30 | 33 | }; |
31 | | -use std::time::{Duration, Instant}; |
32 | 34 |
|
33 | 35 | use futures::future::BoxFuture; |
34 | 36 | use tokio::sync::{ |
35 | 37 | mpsc::{UnboundedReceiver, UnboundedSender}, |
36 | 38 | watch, Notify, |
37 | 39 | }; |
38 | 40 |
|
39 | | -use crate::rcl_bindings::{rcl_timer_get_time_until_next_call, rcl_timer_is_ready, rcl_timer_t}; |
40 | 41 | use crate::{ |
41 | | - log_error, Context, ExecutorChannel, ExecutorRuntime, ExecutorWorkerOptions, OnReadyHandle, |
42 | | - PayloadTask, RclReturnCode, RclrsError, ReadyKind, SpinConditions, ToResult, Waitable, |
43 | | - WeakActivityListener, WorkerChannel, |
| 42 | + log_error, |
| 43 | + rcl_bindings::{rcl_timer_get_time_until_next_call, rcl_timer_is_ready, rcl_timer_t}, |
| 44 | + Context, ExecutorChannel, ExecutorRuntime, ExecutorWorkerOptions, OnReadyHandle, PayloadTask, |
| 45 | + RclReturnCode, RclrsError, ReadyKind, SpinConditions, ToResult, Waitable, WeakActivityListener, |
| 46 | + WorkerChannel, |
44 | 47 | }; |
45 | 48 |
|
46 | 49 | use super::Executor; |
@@ -1002,11 +1005,14 @@ impl CreateTokioExecutor for Context { |
1002 | 1005 | #[cfg(test)] |
1003 | 1006 | mod tests { |
1004 | 1007 | use crate::*; |
1005 | | - use ros_env::test_msgs; |
1006 | | - use ros_env::test_msgs::msg; |
1007 | | - use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; |
1008 | | - use std::sync::Arc; |
1009 | | - use std::time::{Duration, Instant}; |
| 1008 | + use ros_env::{test_msgs, test_msgs::msg}; |
| 1009 | + use std::{ |
| 1010 | + sync::{ |
| 1011 | + atomic::{AtomicBool, AtomicUsize, Ordering}, |
| 1012 | + Arc, |
| 1013 | + }, |
| 1014 | + time::{Duration, Instant}, |
| 1015 | + }; |
1010 | 1016 |
|
1011 | 1017 | /// The executor can adopt the current Tokio runtime (the `#[tokio::main]` |
1012 | 1018 | /// pattern) instead of owning one, and deliver messages while driven by |
|
0 commit comments