Skip to main content

TakenWithInfoAndAttachment

Type Alias TakenWithInfoAndAttachment 

Source
pub type TakenWithInfoAndAttachment = (usize, Option<MessageInfo>, usize);
Expand description

Subscription trait for receiving messages.

§Threading

&mut self on take_serialized — the executor takes exclusive ownership of the subscriber for the duration of a receive. A backend that wants to allow concurrent receives must split into per-thread sub-handles internally.

§Buffer ownership

buf is caller-owned. The implementation copies the next ready message into buf and returns the byte count. The caller may re-use or drop buf immediately after the call.

§Blocking

take_serialized is non-blocking: returns Ok(None) (or equivalent for backends that map empty into a zero-length read) when no message is ready. Use Session::drive_io to wait for data; never sleep inside take_serialized. What Subscription::take_serialized_with_info_and_attachment returns for one sample: (payload_len, info, attachment_len).