pub struct LlmpReceiver<SP> where
SP: ShMemProvider, {
pub id: u32,
pub last_msg_recvd: *const LlmpMsg,
pub shmem_provider: SP,
pub current_recv_shmem: LlmpSharedMap<SP::ShMem>,
/* private fields */
}
Expand description
Receiving end on a (unidirectional) sharedmap channel
Fields
id: u32
Id of this provider
last_msg_recvd: *const LlmpMsg
Pointer to the last message received
shmem_provider: SP
The shmem provider
current_recv_shmem: LlmpSharedMap<SP::ShMem>
current page. After EOP, this gets replaced with the new one
Implementations
sourceimpl<SP> LlmpReceiver<SP> where
SP: ShMemProvider,
impl<SP> LlmpReceiver<SP> where
SP: ShMemProvider,
Receiving end of an llmp channel
sourcepub fn on_existing_from_env(
shmem_provider: SP,
env_name: &str
) -> Result<Self, Error>
pub fn on_existing_from_env(
shmem_provider: SP,
env_name: &str
) -> Result<Self, Error>
Reattach to a vacant recv_shmem
, to with a previous sender stored the information in an env before.
sourcepub fn to_env(&self, env_name: &str) -> Result<(), Error>
pub fn to_env(&self, env_name: &str) -> Result<(), Error>
Store the info to this receiver to env.
A new client can reattach to it using LlmpReceiver::on_existing_from_env()
sourcepub fn on_existing_shmem(
shmem_provider: SP,
current_sender_shmem: SP::ShMem,
last_msg_recvd_offset: Option<u64>
) -> Result<Self, Error>
pub fn on_existing_shmem(
shmem_provider: SP,
current_sender_shmem: SP::ShMem,
last_msg_recvd_offset: Option<u64>
) -> Result<Self, Error>
Create a Receiver, reattaching to an existing sender map.
It is essential, that the sender (or someone else) keeps a pointer to the sender_shmem
else reattach will get a new, empty page, from the OS, or fail.
sourcepub unsafe fn recv_blocking(&mut self) -> Result<*mut LlmpMsg, Error>
pub unsafe fn recv_blocking(&mut self) -> Result<*mut LlmpMsg, Error>
Blocks/spins until the next message gets posted to the page, then returns that message.
Safety
Returns a raw ptr, on the recv map. Should be safe in general
sourcepub fn recv_buf(&mut self) -> Result<Option<(ClientId, Tag, &[u8])>, Error>
pub fn recv_buf(&mut self) -> Result<Option<(ClientId, Tag, &[u8])>, Error>
Returns the next message, tag, buf, if available, else None
sourcepub fn recv_buf_with_flags(
&mut self
) -> Result<Option<(ClientId, Tag, Flags, &[u8])>, Error>
pub fn recv_buf_with_flags(
&mut self
) -> Result<Option<(ClientId, Tag, Flags, &[u8])>, Error>
Receive the buffer, also reading the LLMP internal message flags
sourcepub fn recv_buf_blocking(&mut self) -> Result<(ClientId, Tag, &[u8]), Error>
pub fn recv_buf_blocking(&mut self) -> Result<(ClientId, Tag, &[u8]), Error>
Returns the next sender, tag, buf, looping until it becomes available
sourcepub fn describe(&self) -> Result<LlmpDescription, Error>
pub fn describe(&self) -> Result<LlmpDescription, Error>
Describe this client in a way, that it can be restored later with Self::on_existing_from_description
sourcepub fn on_existing_from_description(
shmem_provider: SP,
description: &LlmpDescription
) -> Result<Self, Error>
pub fn on_existing_from_description(
shmem_provider: SP,
description: &LlmpDescription
) -> Result<Self, Error>
Create this client on an existing map from the given description. acquired with self.describe
Trait Implementations
Auto Trait Implementations
impl<SP> RefUnwindSafe for LlmpReceiver<SP> where
SP: RefUnwindSafe,
<SP as ShMemProvider>::ShMem: RefUnwindSafe,
impl<SP> !Send for LlmpReceiver<SP>
impl<SP> !Sync for LlmpReceiver<SP>
impl<SP> Unpin for LlmpReceiver<SP> where
SP: Unpin,
<SP as ShMemProvider>::ShMem: Unpin,
impl<SP> UnwindSafe for LlmpReceiver<SP> where
SP: UnwindSafe,
<SP as ShMemProvider>::ShMem: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Tail, T> Prepend<T> for Tail
impl<Tail, T> Prepend<T> for Tail
type PreprendResult = Tail
type PreprendResult = Tail
The Resulting TupleList
, of an Prepend::prepend()
call,
including the prepended entry. Read more
sourcefn prepend(self, value: T) -> (T, <Tail as Prepend<T>>::PreprendResult)
fn prepend(self, value: T) -> (T, <Tail as Prepend<T>>::PreprendResult)
Prepend a value to this tuple, returning a new tuple with prepended value.