diff options
| author | huntc <[email protected]> | 2021-07-14 20:06:15 +1000 |
|---|---|---|
| committer | huntc <[email protected]> | 2021-07-15 12:31:53 +1000 |
| commit | 076198a3b99e153fa9b6189d60b2abbfc0b1f29a (patch) | |
| tree | ef7a350abd4801e90596a61a803605b60136782e | |
| parent | d711e8a82cef7ac26191e330aa4bd7cfebd570be (diff) | |
Small tidy up
| -rw-r--r-- | embassy/src/util/mpsc.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/embassy/src/util/mpsc.rs b/embassy/src/util/mpsc.rs index c409161f8..f350c6e53 100644 --- a/embassy/src/util/mpsc.rs +++ b/embassy/src/util/mpsc.rs | |||
| @@ -563,7 +563,7 @@ pub struct Channel<M, T, const N: usize> | |||
| 563 | where | 563 | where |
| 564 | M: Mutex<Data = ()>, | 564 | M: Mutex<Data = ()>, |
| 565 | { | 565 | { |
| 566 | sync_channel: UnsafeCell<ChannelCell<M, T, N>>, | 566 | channel_cell: UnsafeCell<ChannelCell<M, T, N>>, |
| 567 | } | 567 | } |
| 568 | 568 | ||
| 569 | struct ChannelCell<M, T, const N: usize> | 569 | struct ChannelCell<M, T, const N: usize> |
| @@ -593,9 +593,9 @@ impl<T, const N: usize> Channel<WithCriticalSections, T, N> { | |||
| 593 | pub const fn with_critical_sections() -> Self { | 593 | pub const fn with_critical_sections() -> Self { |
| 594 | let mutex = CriticalSectionMutex::new(()); | 594 | let mutex = CriticalSectionMutex::new(()); |
| 595 | let state = ChannelState::new(); | 595 | let state = ChannelState::new(); |
| 596 | let sync_channel = ChannelCell { mutex, state }; | 596 | let channel_cell = ChannelCell { mutex, state }; |
| 597 | Channel { | 597 | Channel { |
| 598 | sync_channel: UnsafeCell::new(sync_channel), | 598 | channel_cell: UnsafeCell::new(channel_cell), |
| 599 | } | 599 | } |
| 600 | } | 600 | } |
| 601 | } | 601 | } |
| @@ -620,9 +620,9 @@ impl<T, const N: usize> Channel<WithThreadModeOnly, T, N> { | |||
| 620 | pub const fn with_thread_mode_only() -> Self { | 620 | pub const fn with_thread_mode_only() -> Self { |
| 621 | let mutex = ThreadModeMutex::new(()); | 621 | let mutex = ThreadModeMutex::new(()); |
| 622 | let state = ChannelState::new(); | 622 | let state = ChannelState::new(); |
| 623 | let sync_channel = ChannelCell { mutex, state }; | 623 | let channel_cell = ChannelCell { mutex, state }; |
| 624 | Channel { | 624 | Channel { |
| 625 | sync_channel: UnsafeCell::new(sync_channel), | 625 | channel_cell: UnsafeCell::new(channel_cell), |
| 626 | } | 626 | } |
| 627 | } | 627 | } |
| 628 | } | 628 | } |
| @@ -644,9 +644,9 @@ impl<T, const N: usize> Channel<WithNoThreads, T, N> { | |||
| 644 | pub const fn with_no_threads() -> Self { | 644 | pub const fn with_no_threads() -> Self { |
| 645 | let mutex = NoopMutex::new(()); | 645 | let mutex = NoopMutex::new(()); |
| 646 | let state = ChannelState::new(); | 646 | let state = ChannelState::new(); |
| 647 | let sync_channel = ChannelCell { mutex, state }; | 647 | let channel_cell = ChannelCell { mutex, state }; |
| 648 | Channel { | 648 | Channel { |
| 649 | sync_channel: UnsafeCell::new(sync_channel), | 649 | channel_cell: UnsafeCell::new(channel_cell), |
| 650 | } | 650 | } |
| 651 | } | 651 | } |
| 652 | } | 652 | } |
| @@ -657,9 +657,9 @@ where | |||
| 657 | { | 657 | { |
| 658 | fn lock<R>(&self, f: impl FnOnce(&mut ChannelState<T, N>) -> R) -> R { | 658 | fn lock<R>(&self, f: impl FnOnce(&mut ChannelState<T, N>) -> R) -> R { |
| 659 | unsafe { | 659 | unsafe { |
| 660 | let sync_channel = &mut *(self.sync_channel.get()); | 660 | let channel_cell = &mut *(self.channel_cell.get()); |
| 661 | let mutex = &mut sync_channel.mutex; | 661 | let mutex = &mut channel_cell.mutex; |
| 662 | let mut state = &mut sync_channel.state; | 662 | let mut state = &mut channel_cell.state; |
| 663 | mutex.lock(|_| f(&mut state)) | 663 | mutex.lock(|_| f(&mut state)) |
| 664 | } | 664 | } |
| 665 | } | 665 | } |
