Add recv_blocking_with_flags (#2102)

* add recv_blocking_with_flags

* rollback, whoops
This commit is contained in:
Addison Crump 2024-04-26 16:22:32 +02:00 committed by GitHub
parent abcb2bf33e
commit c2e0e8ddbe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1775,6 +1775,21 @@ where
} }
} }
/// Receive the buffer, also reading the LLMP internal message flags
#[allow(clippy::type_complexity)]
#[inline]
pub fn recv_buf_blocking_with_flags(&mut self) -> Result<(ClientId, Tag, Flags, &[u8]), Error> {
unsafe {
let msg = self.recv_blocking()?;
Ok((
(*msg).sender,
(*msg).tag,
(*msg).flags,
(*msg).try_as_slice(&mut self.current_recv_shmem)?,
))
}
}
/// Returns the next sender, tag, buf, looping until it becomes available /// Returns the next sender, tag, buf, looping until it becomes available
#[inline] #[inline]
pub fn recv_buf_blocking(&mut self) -> Result<(ClientId, Tag, &[u8]), Error> { pub fn recv_buf_blocking(&mut self) -> Result<(ClientId, Tag, &[u8]), Error> {
@ -3222,6 +3237,12 @@ where
self.receiver.recv_buf_with_flags() self.receiver.recv_buf_with_flags()
} }
/// Receive a `buf` from the broker, including the `flags` used during transmission.
#[allow(clippy::type_complexity)]
pub fn recv_buf_blocking_with_flags(&mut self) -> Result<(ClientId, Tag, Flags, &[u8]), Error> {
self.receiver.recv_buf_blocking_with_flags()
}
#[cfg(feature = "std")] #[cfg(feature = "std")]
/// Creates a new [`LlmpClient`], reading the map id and len from env /// Creates a new [`LlmpClient`], reading the map id and len from env
pub fn create_using_env(mut shmem_provider: SP, env_var: &str) -> Result<Self, Error> { pub fn create_using_env(mut shmem_provider: SP, env_var: &str) -> Result<Self, Error> {