pub struct RingChannels<I, O> {
pub in_tx: Sender<I>,
pub in_rx: Receiver<I>,
pub out_tx: Sender<O>,
pub out_rx: Receiver<O>,
}Expand description
A pair of bounded channels that carry the core <-> gossip ring traffic.
I is the message type the core thread sends to the secondary
thread (typically gossip); O is the message type the secondary
thread sends back.
Fields§
§in_tx: Sender<I>Sender owned by the producer of inbound messages.
in_rx: Receiver<I>Receiver owned by the consumer of inbound messages.
out_tx: Sender<O>Sender owned by the producer of outbound replies.
out_rx: Receiver<O>Receiver owned by the consumer of outbound replies.
Implementations§
Source§impl<I, O> RingChannels<I, O>
impl<I, O> RingChannels<I, O>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new pair sized at the C2G defaults.
§Examples
use dynomite::core::ring_queue::RingChannels;
let _: RingChannels<(), ()> = RingChannels::new();Sourcepub fn with_capacities(in_cap: usize, out_cap: usize) -> Self
pub fn with_capacities(in_cap: usize, out_cap: usize) -> Self
Create a new pair with explicit capacities. Useful for tests and downstream stages that wire smaller queues.
§Examples
use dynomite::core::ring_queue::RingChannels;
let chans: RingChannels<u32, ()> = RingChannels::with_capacities(2, 1);
chans.in_tx.send(1).unwrap();
chans.in_tx.send(2).unwrap();
assert!(chans.in_tx.try_send(3).is_err());Trait Implementations§
Source§impl<I: Clone, O: Clone> Clone for RingChannels<I, O>
impl<I: Clone, O: Clone> Clone for RingChannels<I, O>
Source§fn clone(&self) -> RingChannels<I, O>
fn clone(&self) -> RingChannels<I, O>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<I, O> Freeze for RingChannels<I, O>
impl<I, O> RefUnwindSafe for RingChannels<I, O>
impl<I, O> Send for RingChannels<I, O>
impl<I, O> Sync for RingChannels<I, O>
impl<I, O> Unpin for RingChannels<I, O>
impl<I, O> UnsafeUnpin for RingChannels<I, O>
impl<I, O> UnwindSafe for RingChannels<I, O>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more