Rename channel to mpmc

I've renamed the channel module for the MPMC as mpmc. There was a previous debate about this, but I feel that the strategy here avoids importing `channel::channel`. The change leaves `signal::Signal`, but I think that's ok. It is all a bit subjective of course. The bottom line for me is that I really like the term mpmc - it means something to me and aligns with broader naming e.g. in Tokio.
This commit is contained in:
huntc 2022-06-12 15:16:56 +10:00
parent db344c2bda
commit 99d19c7dcf
12 changed files with 13 additions and 15 deletions

View File

@ -1,7 +1,5 @@
//! Async channels //! Async channels
pub mod channel; pub mod mpmc;
pub use channel::*;
pub mod signal; pub mod signal;
pub use signal::*;

View File

@ -388,7 +388,7 @@ where
/// Establish a new bounded channel. For example, to create one with a NoopMutex: /// Establish a new bounded channel. For example, to create one with a NoopMutex:
/// ///
/// ``` /// ```
/// use embassy::channel::channel::Channel; /// use embassy::channel::mpmc::Channel;
/// use embassy::blocking_mutex::raw::NoopRawMutex; /// use embassy::blocking_mutex::raw::NoopRawMutex;
/// ///
/// // Declare a bounded channel of 3 u32s. /// // Declare a bounded channel of 3 u32s.
@ -404,7 +404,7 @@ where
/// Establish a new bounded channel. For example, to create one with a NoopMutex: /// Establish a new bounded channel. For example, to create one with a NoopMutex:
/// ///
/// ``` /// ```
/// use embassy::channel::channel::Channel; /// use embassy::channel::mpmc::Channel;
/// use embassy::blocking_mutex::raw::NoopRawMutex; /// use embassy::blocking_mutex::raw::NoopRawMutex;
/// ///
/// // Declare a bounded channel of 3 u32s. /// // Declare a bounded channel of 3 u32s.

View File

@ -5,7 +5,7 @@ use core::task::{Context, Poll, Waker};
/// Synchronization primitive. Allows creating awaitable signals that may be passed between tasks. /// Synchronization primitive. Allows creating awaitable signals that may be passed between tasks.
/// For a simple use-case where the receiver is only ever interested in the latest value of /// For a simple use-case where the receiver is only ever interested in the latest value of
/// something, Signals work well. For more advanced use cases, you might want to use [`Channel`](crate::channel::channel::Channel) instead.. /// something, Signals work well. For more advanced use cases, you might want to use [`Channel`](crate::channel::mpmc::Channel) instead..
/// ///
/// Signals are generally declared as being a static const and then borrowed as required. /// Signals are generally declared as being a static const and then borrowed as required.
/// ///

View File

@ -4,7 +4,7 @@
use defmt::unwrap; use defmt::unwrap;
use embassy::blocking_mutex::raw::ThreadModeRawMutex; use embassy::blocking_mutex::raw::ThreadModeRawMutex;
use embassy::channel::channel::Channel; use embassy::channel::mpmc::Channel;
use embassy::executor::Spawner; use embassy::executor::Spawner;
use embassy::time::{Duration, Timer}; use embassy::time::{Duration, Timer};
use embassy_nrf::gpio::{Level, Output, OutputDrive}; use embassy_nrf::gpio::{Level, Output, OutputDrive};

View File

@ -4,7 +4,7 @@
use defmt::unwrap; use defmt::unwrap;
use embassy::blocking_mutex::raw::NoopRawMutex; use embassy::blocking_mutex::raw::NoopRawMutex;
use embassy::channel::channel::{Channel, Receiver, Sender}; use embassy::channel::mpmc::{Channel, Receiver, Sender};
use embassy::executor::Spawner; use embassy::executor::Spawner;
use embassy::time::{Duration, Timer}; use embassy::time::{Duration, Timer};
use embassy::util::Forever; use embassy::util::Forever;

View File

@ -4,7 +4,7 @@
use defmt::*; use defmt::*;
use embassy::blocking_mutex::raw::ThreadModeRawMutex; use embassy::blocking_mutex::raw::ThreadModeRawMutex;
use embassy::channel::channel::Channel; use embassy::channel::mpmc::Channel;
use embassy::executor::Spawner; use embassy::executor::Spawner;
use embassy_nrf::peripherals::UARTE0; use embassy_nrf::peripherals::UARTE0;
use embassy_nrf::uarte::UarteRx; use embassy_nrf::uarte::UarteRx;

View File

@ -8,7 +8,7 @@ use core::sync::atomic::{AtomicBool, Ordering};
use core::task::Waker; use core::task::Waker;
use defmt::*; use defmt::*;
use embassy::blocking_mutex::raw::ThreadModeRawMutex; use embassy::blocking_mutex::raw::ThreadModeRawMutex;
use embassy::channel::Channel; use embassy::channel::mpmc::Channel;
use embassy::executor::Spawner; use embassy::executor::Spawner;
use embassy::util::Forever; use embassy::util::Forever;
use embassy_net::tcp::TcpSocket; use embassy_net::tcp::TcpSocket;

View File

@ -6,7 +6,7 @@
use core::mem; use core::mem;
use core::sync::atomic::{AtomicBool, Ordering}; use core::sync::atomic::{AtomicBool, Ordering};
use defmt::*; use defmt::*;
use embassy::channel::Signal; use embassy::channel::signal::Signal;
use embassy::executor::Spawner; use embassy::executor::Spawner;
use embassy::interrupt::InterruptExt; use embassy::interrupt::InterruptExt;
use embassy::time::Duration; use embassy::time::Duration;

View File

@ -12,7 +12,7 @@
use defmt::*; use defmt::*;
use embassy::blocking_mutex::raw::ThreadModeRawMutex; use embassy::blocking_mutex::raw::ThreadModeRawMutex;
use embassy::channel::channel::Channel; use embassy::channel::mpmc::Channel;
use embassy::executor::Spawner; use embassy::executor::Spawner;
use embassy::time::{with_timeout, Duration, Timer}; use embassy::time::{with_timeout, Duration, Timer};
use embassy_stm32::exti::ExtiInput; use embassy_stm32::exti::ExtiInput;

View File

@ -8,7 +8,7 @@ use defmt_rtt as _;
use panic_probe as _; use panic_probe as _;
use embassy::channel::Signal; use embassy::channel::signal::Signal;
use embassy::executor::Spawner; use embassy::executor::Spawner;
use embassy::time::{Duration, Timer}; use embassy::time::{Duration, Timer};

View File

@ -5,7 +5,7 @@
use defmt::*; use defmt::*;
use defmt_rtt as _; // global logger use defmt_rtt as _; // global logger
use embassy::blocking_mutex::raw::ThreadModeRawMutex; use embassy::blocking_mutex::raw::ThreadModeRawMutex;
use embassy::channel::channel::Channel; use embassy::channel::mpmc::Channel;
use embassy::executor::Spawner; use embassy::executor::Spawner;
use embassy_stm32::dma::NoDma; use embassy_stm32::dma::NoDma;
use embassy_stm32::{ use embassy_stm32::{

View File

@ -8,7 +8,7 @@ use core::task::Waker;
use defmt::*; use defmt::*;
use defmt_rtt as _; // global logger use defmt_rtt as _; // global logger
use embassy::blocking_mutex::raw::ThreadModeRawMutex; use embassy::blocking_mutex::raw::ThreadModeRawMutex;
use embassy::channel::Channel; use embassy::channel::mpmc::Channel;
use embassy::executor::Spawner; use embassy::executor::Spawner;
use embassy::util::Forever; use embassy::util::Forever;
use embassy_net::tcp::TcpSocket; use embassy_net::tcp::TcpSocket;