pub(crate) struct ChannelReceiver(pub(in core) GcHeap<ChannelReceiverInner>);Expand description
The receiving half of a channel.
Tuple Fields§
§0: GcHeap<ChannelReceiverInner>Implementations§
Source§impl ChannelReceiver
impl ChannelReceiver
pub(in core) fn new( channel_id: u64, manager: Arc<ChannelManager>, constant: bool, ) -> Self
Sourcepub(crate) fn recv<'ob>(
&self,
cx: &'ob Context<'_>,
) -> Result<Gc<ObjectType<'ob>>, RecvError>
pub(crate) fn recv<'ob>( &self, cx: &'ob Context<'_>, ) -> Result<Gc<ObjectType<'ob>>, RecvError>
Receive an object from the channel, blocking if empty. Returns Err(RecvError::Closed) if all senders have been dropped.
Sourcepub(crate) fn try_recv<'ob>(
&self,
cx: &'ob Context<'_>,
) -> Result<Gc<ObjectType<'ob>>, RecvError>
pub(crate) fn try_recv<'ob>( &self, cx: &'ob Context<'_>, ) -> Result<Gc<ObjectType<'ob>>, RecvError>
Try to receive without blocking. Returns Err(RecvError::Empty) if the channel is empty. Returns Err(RecvError::Closed) if all senders have been dropped.
Sourcepub(crate) fn recv_timeout<'ob>(
&self,
cx: &'ob Context<'_>,
timeout: Duration,
) -> Result<Gc<ObjectType<'ob>>, RecvError>
pub(crate) fn recv_timeout<'ob>( &self, cx: &'ob Context<'_>, timeout: Duration, ) -> Result<Gc<ObjectType<'ob>>, RecvError>
Receive with a timeout. Returns Err(RecvError::Timeout) if the timeout expires. Returns Err(RecvError::Closed) if all senders have been dropped.
Sourcepub(crate) fn close(&self)
pub(crate) fn close(&self)
Explicitly close the receiver side of the channel. This wakes up any senders waiting on send() and causes them to return Err(SendError::Closed). This is idempotent - calling close() multiple times has no additional effect.
Useful for “moving” a receiver to another thread: the original receiver can be closed after being cloned into a new context.
Trait Implementations§
Source§impl<'new> CloneIn<'new, &'new ChannelReceiver> for ChannelReceiver
impl<'new> CloneIn<'new, &'new ChannelReceiver> for ChannelReceiver
Source§impl Debug for ChannelReceiver
impl Debug for ChannelReceiver
Source§impl Display for ChannelReceiver
impl Display for ChannelReceiver
Source§impl<'ob> From<&'ob ChannelReceiver> for Gc<ObjectType<'ob>>
impl<'ob> From<&'ob ChannelReceiver> for Gc<ObjectType<'ob>>
Source§fn from(x: &'ob ChannelReceiver) -> Self
fn from(x: &'ob ChannelReceiver) -> Self
Source§impl GcMoveable for ChannelReceiver
impl GcMoveable for ChannelReceiver
Source§impl IntoObject for ChannelReceiver
impl IntoObject for ChannelReceiver
Source§impl PartialEq for ChannelReceiver
impl PartialEq for ChannelReceiver
Source§impl TaggedPtr for &ChannelReceiver
impl TaggedPtr for &ChannelReceiver
Source§const TAG: Tag = Tag::ChannelReceiver
const TAG: Tag = Tag::ChannelReceiver
Source§type Ptr = ChannelReceiver
type Ptr = ChannelReceiver
Source§unsafe fn from_obj_ptr(ptr: *const u8) -> Self
unsafe fn from_obj_ptr(ptr: *const u8) -> Self
Source§unsafe fn tag_ptr(ptr: *const Self::Ptr) -> Gc<Self>
unsafe fn tag_ptr(ptr: *const Self::Ptr) -> Gc<Self>
Ptr return a Tagged pointer. Read moreSource§fn untag(val: Gc<Self>) -> Self
fn untag(val: Gc<Self>) -> Self
Gc<T> and return the inner type. If it is
base type then it will only have a single possible value and can be
untagged without checks, but sum types need to create all values
they can hold. We use tagged base types to let us reinterpret bits
without actually modify them. Read moreSource§impl<'old, 'new> WithLifetime<'new> for &'old ChannelReceiver
impl<'old, 'new> WithLifetime<'new> for &'old ChannelReceiver
type Out = &'new ChannelReceiver
unsafe fn with_lifetime(self) -> Self::Out
impl Eq for ChannelReceiver
impl GcPtr for &ChannelReceiver
Auto Trait Implementations§
impl !Freeze for ChannelReceiver
impl !RefUnwindSafe for ChannelReceiver
impl Send for ChannelReceiver
impl Sync for ChannelReceiver
impl Unpin for ChannelReceiver
impl UnwindSafe for ChannelReceiver
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.