pub struct Receiver<T, Codec = Default, const MAX_ITEM_SIZE: usize = DEFAULT_MAX_ITEM_SIZE> { /* private fields */ }
rch
only.Expand description
Receive values from the associated Sender, which may be located on a remote endpoint.
Instances are created by the channel function.
This can be converted into a Stream of values by wrapping it into a ReceiverStream.
Implementations§
source§impl<T, Codec, const MAX_ITEM_SIZE: usize> Receiver<T, Codec, MAX_ITEM_SIZE>
impl<T, Codec, const MAX_ITEM_SIZE: usize> Receiver<T, Codec, MAX_ITEM_SIZE>
sourcepub fn borrow(&self) -> Result<Ref<'_, T>, RecvError>
pub fn borrow(&self) -> Result<Ref<'_, T>, RecvError>
Returns a reference to the most recently received value.
sourcepub fn borrow_and_update(&mut self) -> Result<Ref<'_, T>, RecvError>
pub fn borrow_and_update(&mut self) -> Result<Ref<'_, T>, RecvError>
Returns a reference to the most recently received value and mark that value as seen.
sourcepub async fn changed(&mut self) -> Result<(), ChangedError>
pub async fn changed(&mut self) -> Result<(), ChangedError>
Wait for a change notification, then mark the newest value as seen.
sourcepub fn max_item_size(&self) -> usize
pub fn max_item_size(&self) -> usize
Maximum allowed item size in bytes when receiving items.
sourcepub fn set_max_item_size<const NEW_MAX_ITEM_SIZE: usize>(
self
) -> Receiver<T, Codec, NEW_MAX_ITEM_SIZE>
pub fn set_max_item_size<const NEW_MAX_ITEM_SIZE: usize>( self ) -> Receiver<T, Codec, NEW_MAX_ITEM_SIZE>
Sets the maximum allowed item size in bytes when receiving items.
sourcepub fn remote_max_item_size(&self) -> Option<usize>
pub fn remote_max_item_size(&self) -> Option<usize>
The maximum item size of the remote sender.
If this is larger than max_item_size sending of oversized items will succeed but receiving will fail with a MaxItemSizeExceeded error.
Trait Implementations§
source§impl<T: Clone, Codec: Clone, const MAX_ITEM_SIZE: usize> Clone for Receiver<T, Codec, MAX_ITEM_SIZE>
impl<T: Clone, Codec: Clone, const MAX_ITEM_SIZE: usize> Clone for Receiver<T, Codec, MAX_ITEM_SIZE>
source§impl<'de, T, Codec, const MAX_ITEM_SIZE: usize> Deserialize<'de> for Receiver<T, Codec, MAX_ITEM_SIZE>
impl<'de, T, Codec, const MAX_ITEM_SIZE: usize> Deserialize<'de> for Receiver<T, Codec, MAX_ITEM_SIZE>
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserializes the receiver after it has been received over a chmux channel.