// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 mod recv; mod send; mod slice; mod state; use slice::*; use state::*; pub use recv::{Receiver, RecvSlice}; pub use send::{SendSlice, Sender}; #[inline] pub fn channel(capacity: usize) -> (Sender, Receiver) { let state = State::new(capacity); let sender = Sender(state.clone()); let receiver = Receiver(state); (sender, receiver) } #[cfg(test)] mod tests; type Result = core::result::Result; #[derive(Clone, Copy, Debug)] pub struct ClosedError; #[derive(Clone, Copy, Debug)] pub enum PushError { Full(T), Closed, } impl From for PushError { fn from(_error: ClosedError) -> Self { Self::Closed } }