[−][src]Struct ipmpsc::Receiver
Represents the receiving end of an inter-process channel, capable
of receiving any message type implementing
serde::Deserialize
.
Methods
impl Receiver
[src]
pub fn from_path(path: &str, size_in_bytes: u32) -> Result<Receiver, Error>
[src]
Creates a new Receiver
backed by a file with the specified
name.
The file will be created if it does not already exist or
truncated otherwise. Once this method has returned
successfully, any number of senders may be created using the
Sender::from_path
method.
pub fn temp_file(size_in_bytes: u32) -> Result<(String, Receiver), Error>
[src]
Creates a new Receiver
backed by a
temporary file which will be deleted when the
Receiver
is dropped.
The name of the file is returned along with the
Receiver
and may be used to create
one or more corresponding senders using the
Sender::from_path
method.
pub fn try_recv<T>(&self) -> Result<Option<T>, Error> where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
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, Error> where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
Attempt to read a message, blocking if necessary until one becomes available.
pub fn recv_timeout<T>(&self, timeout: Duration) -> Result<Option<T>, Error> where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
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]
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
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,