Struct ipmpsc::Receiver [−][src]
pub struct Receiver(_);
Expand description
Represents the receiving end of an inter-process channel, capable of receiving any message type implementing
serde::Deserialize
.
Implementations
impl Receiver
[src]
impl Receiver
[src]pub fn new(buffer: SharedRingBuffer) -> Self
[src]
pub fn new(buffer: SharedRingBuffer) -> Self
[src]Constructs a Receiver
from the specified
SharedRingBuffer
pub fn try_recv<T>(&self) -> Result<Option<T>> where
T: for<'de> Deserialize<'de>,
[src]
pub fn try_recv<T>(&self) -> Result<Option<T>> where
T: for<'de> Deserialize<'de>,
[src]Attempt to read a message without blocking.
This will return Ok(None)
if there are no messages immediately available.
pub fn recv<T>(&self) -> Result<T> where
T: for<'de> Deserialize<'de>,
[src]
pub fn recv<T>(&self) -> Result<T> where
T: for<'de> Deserialize<'de>,
[src]Attempt to read a message, blocking if necessary until one becomes available.
pub fn recv_timeout<T>(&self, timeout: Duration) -> Result<Option<T>> where
T: for<'de> Deserialize<'de>,
[src]
pub fn recv_timeout<T>(&self, timeout: Duration) -> Result<Option<T>> where
T: for<'de> Deserialize<'de>,
[src]Attempt to read a message, blocking for up to the specified duration if necessary until one becomes available.
pub fn zero_copy_context(&mut self) -> ZeroCopyContext<'_>
[src]
pub fn zero_copy_context(&mut self) -> ZeroCopyContext<'_>
[src]Borrows this receiver for deserializing a message with references that refer directly to this
Receiver
’s ring buffer rather than copying out of it.
Because those references refer directly to the ring buffer, the read pointer cannot be advanced until the lifetime of those references ends.
To ensure the above, the following rules apply:
-
The underlying
Receiver
cannot be used while aZeroCopyContext
borrows it (enforced at compile time). -
References in a message deserialized using a given
ZeroCopyContext
cannot outlive that instance (enforced at compile time). -
A given
ZeroCopyContext
can only be used to deserialize a single message before it must be discarded since the read pointer is advanced only when the instance is dropped (enforced at run time).
Auto Trait Implementations
impl !RefUnwindSafe for Receiver
impl Send for Receiver
impl Sync for Receiver
impl Unpin for Receiver
impl !UnwindSafe for Receiver
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,