use std::fmt::Debug;
pub mod bounded;
pub mod broadcast;
pub mod newest;
pub mod unbounded;
#[cfg(feature = "async-channels")]
pub mod async_;
pub mod policy;
pub use bounded::{BoundedReceiver, BoundedSender, bounded};
pub use broadcast::{BroadcastReceiver, BroadcastSender, broadcast};
pub use newest::{NewestReceiver, NewestSender, newest};
pub use unbounded::{UnboundedReceiver, UnboundedSender, unbounded};
#[cfg(feature = "metrics")]
pub use bounded::bounded_with_metrics;
#[cfg(feature = "metrics")]
pub use broadcast::broadcast_with_metrics;
#[cfg(feature = "metrics")]
pub use newest::newest_with_metrics;
#[cfg(feature = "metrics")]
pub use unbounded::unbounded_with_metrics;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Backpressure {
Ok,
Full,
Closed,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum RecvOutcome<T> {
Data(T),
Empty,
Closed,
}
pub trait ChannelSend<T>: Send + Sync {
fn send(&self, value: T) -> Backpressure;
}
pub trait ChannelRecv<T>: Send + Sync {
fn try_recv(&self) -> RecvOutcome<T>;
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CloseBehavior {
FailFast,
DrainUntilSendersDone,
}
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct ChannelStats {
pub enqueued: u64,
pub dropped: u64,
pub drained: u64,
pub depth: usize,
pub closed: bool,
}