struct ReceiverState<T: Debug + Send + 'static, C: ChannelSpec> {
rx: StreamUnobtrusivePeeker<C::Receiver<Entry<T>>>,
mq: TypedParticipation<Entry<T>>,
collapse_callbacks: Vec<CollapseCallback>,
}
Expand description
Mutable state of a Receiver
Normally the mutex is only locked by the receiving task.
On memory pressure, mutex is acquired by the memory system,
which has a clone of the Arc<ReceiverInner>
.
Within Arc<Mutex<Result<, >>>
.
Fields§
§rx: StreamUnobtrusivePeeker<C::Receiver<Entry<T>>>
The inner stream, but with an unobtrusive peek for getting the oldest data age
mq: TypedParticipation<Entry<T>>
The Participation
, which we use for memory accounting
§Performance and locality
We have separate Participation
s for rx and tx.
The tx is constantly claiming and the rx releasing;
at least each MAX_CACHE, they must balance out
via the (fairly globally shared) MemoryQuotaTracker
.
If this turns out to be a problem,
we could arrange to share a Participation
.
collapse_callbacks: Vec<CollapseCallback>
Hooks passed to Receiver::register_collapse_hook
When receiver dropped, or memory reclaimed, we call all of these.
Trait Implementations§
Source§impl<T: Debug + Send + 'static, C: ChannelSpec> Debug for ReceiverState<T, C>
impl<T: Debug + Send + 'static, C: ChannelSpec> Debug for ReceiverState<T, C>
Auto Trait Implementations§
impl<T, C> Freeze for ReceiverState<T, C>
impl<T, C> !RefUnwindSafe for ReceiverState<T, C>
impl<T, C> Send for ReceiverState<T, C>
impl<T, C> Sync for ReceiverState<T, C>
impl<T, C> Unpin for ReceiverState<T, C>
impl<T, C> !UnwindSafe for ReceiverState<T, C>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more