pub(crate) struct Receiver<T> {
shared: Arc<Shared<T>>,
is_waiting_for_msg: bool,
}Expand description
The receiving end of the oneshot channel.
Fields§
State shared with the Sender.
is_waiting_for_msg: boolAre we still waiting to receive the message?
Implementations§
Source§impl<T> Receiver<T>
impl<T> Receiver<T>
Sourcepub(crate) fn is_waiting_for_msg(&self) -> bool
pub(crate) fn is_waiting_for_msg(&self) -> bool
Is this receiver waiting for a message?
This is true if the receiver has a Sender that it has not read a message from yet.
If this returns false, then a
new Sender can be successfully created.
Sourcepub(crate) fn new_sender(&mut self) -> Option<Sender<T>>
pub(crate) fn new_sender(&mut self) -> Option<Sender<T>>
Create a new Sender.
Can only have one sender at a time.
Returns None if we’ve previously created a sender and we haven’t read its message yet.
Sourcepub(crate) fn guarantee_new_sender(&mut self) -> Option<SenderGuarantee<'_, T>>
pub(crate) fn guarantee_new_sender(&mut self) -> Option<SenderGuarantee<'_, T>>
Provides a type that can be converted into a new Sender.
This can be useful if you don’t want a new Sender yet,
but you want a guarantee that a sender can be created later.
Returns None if we’ve previously created a sender and we haven’t read its message yet.
Sourcepub(crate) fn recv<'a>(&'a mut self) -> Result<ReceiverFuture<'a, T>, NoSender>
pub(crate) fn recv<'a>(&'a mut self) -> Result<ReceiverFuture<'a, T>, NoSender>
Receive the message.
Sourcepub(crate) fn try_recv(&mut self) -> Result<Option<T>, RecvError>
pub(crate) fn try_recv(&mut self) -> Result<Option<T>, RecvError>
Try to receive a message without blocking.
Sourcefn recv_impl(&mut self) -> Option<Result<T, SenderDropped>>
fn recv_impl(&mut self) -> Option<Result<T, SenderDropped>>
The shared implementation to receive the message.
The “message has not yet been set” path is quick (just an atomic load) so its cheap to check.
Returns None if there’s no update.
Returns Some if we have the message or the sender was dropped.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Receiver<T>
impl<T> !UnwindSafe for Receiver<T>
impl<T> Forget for Receiver<T>
impl<T> Freeze for Receiver<T>
impl<T> Move for Receiver<T>
impl<T> Send for Receiver<T>
impl<T> Sync for Receiver<T>
impl<T> Unpin for Receiver<T>
impl<T> UnsafeUnpin for Receiver<T>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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