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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.