You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asyncband.apache.org by ti...@apache.org on 2026/08/26 16:50:21 UTC
(asyncband) branch main updated: refactor(channel): establish private source layout (#217)
This is an automated email from the ASF dual-hosted git repository.
tisonkun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/asyncband.git
The following commit(s) were added to refs/heads/main by this push:
new ba3662c refactor(channel): establish private source layout (#217)
ba3662c is described below
commit ba3662c0c28e564b24e22190bf7183ed990eb777
Author: tison <wa...@gmail.com>
AuthorDate: Thu Aug 27 00:50:17 2026 +0800
refactor(channel): establish private source layout (#217)
---
asyncband/src/{mpsc => channel}/mod.rs | 20 ++++----------------
asyncband/src/{ => channel}/mpsc/bounded.rs | 8 ++++----
asyncband/src/{ => channel}/mpsc/error.rs | 0
asyncband/src/{ => channel}/mpsc/mod.rs | 0
asyncband/src/{ => channel}/mpsc/unbounded.rs | 6 +++---
asyncband/src/{ => channel}/oneshot/mod.rs | 0
asyncband/src/{ => channel}/oneshot/receiver.rs | 18 +++++++++---------
asyncband/src/{ => channel}/oneshot/sender.rs | 16 ++++++++--------
asyncband/src/{ => channel}/oneshot/tests.rs | 0
asyncband/src/lib.rs | 5 +++--
10 files changed, 31 insertions(+), 42 deletions(-)
diff --git a/asyncband/src/mpsc/mod.rs b/asyncband/src/channel/mod.rs
similarity index 64%
copy from asyncband/src/mpsc/mod.rs
copy to asyncband/src/channel/mod.rs
index 87c7c8f..58689a6 100644
--- a/asyncband/src/mpsc/mod.rs
+++ b/asyncband/src/channel/mod.rs
@@ -15,19 +15,7 @@
// specific language governing permissions and limitations
// under the License.
-//! A multi-producer, single-consumer queue for sending values between asynchronous tasks.
-
-mod bounded;
-mod error;
-mod unbounded;
-
-pub use bounded::BoundedReceiver;
-pub use bounded::BoundedSender;
-pub use bounded::bounded;
-pub use error::RecvError;
-pub use error::SendError;
-pub use error::TryRecvError;
-pub use error::TrySendError;
-pub use unbounded::UnboundedReceiver;
-pub use unbounded::UnboundedSender;
-pub use unbounded::unbounded;
+#[cfg(feature = "mpsc")]
+pub mod mpsc;
+#[cfg(feature = "oneshot")]
+pub mod oneshot;
diff --git a/asyncband/src/mpsc/bounded.rs b/asyncband/src/channel/mpsc/bounded.rs
similarity index 98%
rename from asyncband/src/mpsc/bounded.rs
rename to asyncband/src/channel/mpsc/bounded.rs
index 60f0da0..08aefd4 100644
--- a/asyncband/src/mpsc/bounded.rs
+++ b/asyncband/src/channel/mpsc/bounded.rs
@@ -28,13 +28,13 @@ use std::sync::atomic::Ordering;
use std::task::Context;
use std::task::Poll;
+use super::RecvError;
+use super::SendError;
+use super::TryRecvError;
+use super::TrySendError;
use crate::internal::atomic_waker::AtomicWaker;
use crate::internal::semaphore::Acquire;
use crate::internal::semaphore::Semaphore;
-use crate::mpsc::RecvError;
-use crate::mpsc::SendError;
-use crate::mpsc::TryRecvError;
-use crate::mpsc::error::TrySendError;
/// Creates a bounded mpsc channel for communicating between asynchronous
/// tasks with backpressure.
diff --git a/asyncband/src/mpsc/error.rs b/asyncband/src/channel/mpsc/error.rs
similarity index 100%
rename from asyncband/src/mpsc/error.rs
rename to asyncband/src/channel/mpsc/error.rs
diff --git a/asyncband/src/mpsc/mod.rs b/asyncband/src/channel/mpsc/mod.rs
similarity index 100%
rename from asyncband/src/mpsc/mod.rs
rename to asyncband/src/channel/mpsc/mod.rs
diff --git a/asyncband/src/mpsc/unbounded.rs b/asyncband/src/channel/mpsc/unbounded.rs
similarity index 99%
rename from asyncband/src/mpsc/unbounded.rs
rename to asyncband/src/channel/mpsc/unbounded.rs
index eb446be..3ee892a 100644
--- a/asyncband/src/mpsc/unbounded.rs
+++ b/asyncband/src/channel/mpsc/unbounded.rs
@@ -26,10 +26,10 @@ use std::sync::atomic::Ordering;
use std::task::Context;
use std::task::Poll;
+use super::RecvError;
+use super::SendError;
+use super::TryRecvError;
use crate::internal::atomic_waker::AtomicWaker;
-use crate::mpsc::RecvError;
-use crate::mpsc::SendError;
-use crate::mpsc::TryRecvError;
/// Creates an unbounded mpsc channel for communicating between asynchronous
/// tasks without backpressure.
diff --git a/asyncband/src/oneshot/mod.rs b/asyncband/src/channel/oneshot/mod.rs
similarity index 100%
rename from asyncband/src/oneshot/mod.rs
rename to asyncband/src/channel/oneshot/mod.rs
diff --git a/asyncband/src/oneshot/receiver.rs b/asyncband/src/channel/oneshot/receiver.rs
similarity index 98%
rename from asyncband/src/oneshot/receiver.rs
rename to asyncband/src/channel/oneshot/receiver.rs
index 29f913b..7d232dc 100644
--- a/asyncband/src/oneshot/receiver.rs
+++ b/asyncband/src/channel/oneshot/receiver.rs
@@ -24,16 +24,16 @@ use std::sync::atomic::fence;
use std::task::Context;
use std::task::Poll;
-use crate::oneshot::AWAKING;
-use crate::oneshot::Channel;
-use crate::oneshot::DISCONNECTED;
-use crate::oneshot::EMPTY;
-use crate::oneshot::MESSAGE;
-use crate::oneshot::RECEIVING;
+use super::AWAKING;
+use super::Channel;
+use super::DISCONNECTED;
+use super::EMPTY;
+use super::MESSAGE;
+use super::RECEIVING;
#[cfg(doc)]
-use crate::oneshot::Sender;
-use crate::oneshot::deallocate_empty_channel;
-use crate::oneshot::drop_message_and_deallocate_channel;
+use super::Sender;
+use super::deallocate_empty_channel;
+use super::drop_message_and_deallocate_channel;
/// Receives a value from the associated [`Sender`].
pub struct Receiver<T> {
diff --git a/asyncband/src/oneshot/sender.rs b/asyncband/src/channel/oneshot/sender.rs
similarity index 97%
rename from asyncband/src/oneshot/sender.rs
rename to asyncband/src/channel/oneshot/sender.rs
index adf45ee..58a712c 100644
--- a/asyncband/src/oneshot/sender.rs
+++ b/asyncband/src/channel/oneshot/sender.rs
@@ -22,15 +22,15 @@ use std::ptr::NonNull;
use std::sync::atomic::Ordering;
use std::sync::atomic::fence;
-use crate::oneshot::Channel;
-use crate::oneshot::DISCONNECTED;
-use crate::oneshot::EMPTY;
-use crate::oneshot::MESSAGE;
-use crate::oneshot::RECEIVING;
+use super::Channel;
+use super::DISCONNECTED;
+use super::EMPTY;
+use super::MESSAGE;
+use super::RECEIVING;
#[cfg(doc)]
-use crate::oneshot::Receiver;
-use crate::oneshot::deallocate_empty_channel;
-use crate::oneshot::drop_message_and_deallocate_channel;
+use super::Receiver;
+use super::deallocate_empty_channel;
+use super::drop_message_and_deallocate_channel;
/// Sends a value to the associated [`Receiver`].
pub struct Sender<T> {
diff --git a/asyncband/src/oneshot/tests.rs b/asyncband/src/channel/oneshot/tests.rs
similarity index 100%
rename from asyncband/src/oneshot/tests.rs
rename to asyncband/src/channel/oneshot/tests.rs
diff --git a/asyncband/src/lib.rs b/asyncband/src/lib.rs
index 41a52d8..733275a 100644
--- a/asyncband/src/lib.rs
+++ b/asyncband/src/lib.rs
@@ -100,6 +100,7 @@
//!
//! While incubation status is not necessarily a reflection of the completeness or stability of the
//! code, it does indicate that the project has yet to be fully endorsed by the ASF.
+mod channel;
mod internal;
#[cfg(feature = "barrier")]
@@ -111,7 +112,7 @@ pub mod condvar;
#[cfg(feature = "latch")]
pub mod latch;
#[cfg(feature = "mpsc")]
-pub mod mpsc;
+pub use self::channel::mpsc;
#[cfg(feature = "mutex")]
pub mod mutex;
#[cfg(any(
@@ -122,7 +123,7 @@ pub mod mutex;
))]
pub mod once;
#[cfg(feature = "oneshot")]
-pub mod oneshot;
+pub use self::channel::oneshot;
#[cfg(feature = "pool")]
pub mod pool;
#[cfg(feature = "rwlock")]
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For additional commands, e-mail: commits-help@asyncband.apache.org