aboutsummaryrefslogtreecommitdiff
path: root/embassy-sync/src/priority_channel.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-10-06 22:56:31 +0200
committerDario Nieuwenhuis <[email protected]>2025-10-06 23:19:53 +0200
commit8730a013c395cf0bf4c2fa8eeb7f138288103039 (patch)
tree39eca5fbc4570bd0129c9a291f134de5dab98820 /embassy-sync/src/priority_channel.rs
parentabc8e450f936567ad42cb34b5d2a7941b206aa5d (diff)
Rustfmt for edition 2024.
Diffstat (limited to 'embassy-sync/src/priority_channel.rs')
-rw-r--r--embassy-sync/src/priority_channel.rs32
1 files changed, 18 insertions, 14 deletions
diff --git a/embassy-sync/src/priority_channel.rs b/embassy-sync/src/priority_channel.rs
index 715a20e86..1af7d9221 100644
--- a/embassy-sync/src/priority_channel.rs
+++ b/embassy-sync/src/priority_channel.rs
@@ -8,11 +8,11 @@ use core::future::Future;
8use core::pin::Pin; 8use core::pin::Pin;
9use core::task::{Context, Poll}; 9use core::task::{Context, Poll};
10 10
11pub use heapless::binary_heap::{Kind, Max, Min};
12use heapless::BinaryHeap; 11use heapless::BinaryHeap;
12pub use heapless::binary_heap::{Kind, Max, Min};
13 13
14use crate::blocking_mutex::raw::RawMutex;
15use crate::blocking_mutex::Mutex; 14use crate::blocking_mutex::Mutex;
15use crate::blocking_mutex::raw::RawMutex;
16use crate::channel::{DynamicChannel, DynamicReceiver, DynamicSender, TryReceiveError, TrySendError}; 16use crate::channel::{DynamicChannel, DynamicReceiver, DynamicSender, TryReceiveError, TrySendError};
17use crate::waitqueue::WakerRegistration; 17use crate::waitqueue::WakerRegistration;
18 18
@@ -799,11 +799,13 @@ mod tests {
799 static CHANNEL: StaticCell<PriorityChannel<CriticalSectionRawMutex, u32, Max, 3>> = StaticCell::new(); 799 static CHANNEL: StaticCell<PriorityChannel<CriticalSectionRawMutex, u32, Max, 3>> = StaticCell::new();
800 let c = &*CHANNEL.init(PriorityChannel::new()); 800 let c = &*CHANNEL.init(PriorityChannel::new());
801 let c2 = c; 801 let c2 = c;
802 assert!(executor 802 assert!(
803 .spawn(async move { 803 executor
804 assert!(c2.try_send(1).is_ok()); 804 .spawn(async move {
805 }) 805 assert!(c2.try_send(1).is_ok());
806 .is_ok()); 806 })
807 .is_ok()
808 );
807 assert_eq!(c.receive().await, 1); 809 assert_eq!(c.receive().await, 1);
808 } 810 }
809 811
@@ -830,13 +832,15 @@ mod tests {
830 // However, I've used the debugger to observe that the send does indeed wait. 832 // However, I've used the debugger to observe that the send does indeed wait.
831 Delay::new(Duration::from_millis(500)).await; 833 Delay::new(Duration::from_millis(500)).await;
832 assert_eq!(c.receive().await, 1); 834 assert_eq!(c.receive().await, 1);
833 assert!(executor 835 assert!(
834 .spawn(async move { 836 executor
835 loop { 837 .spawn(async move {
836 c.receive().await; 838 loop {
837 } 839 c.receive().await;
838 }) 840 }
839 .is_ok()); 841 })
842 .is_ok()
843 );
840 send_task_1.unwrap().await; 844 send_task_1.unwrap().await;
841 send_task_2.unwrap().await; 845 send_task_2.unwrap().await;
842 } 846 }