Struct tmq::Multipart

source ·
pub struct Multipart(pub VecDeque<Message>);
Expand description

ZMQ multipart which holds individual messages.

It is implemented with a VecDeque to allow efficient popping from the beginning. This is useful both for async Read/Write implementations and for consuming the multipart.

Tuple Fields§

§0: VecDeque<Message>

Implementations§

source§

impl Multipart

source

pub fn is_empty(&self) -> bool

Returns true if the multipart contains no messages.

source

pub fn len(&self) -> usize

Returns the number of messages in the multipart.

source

pub fn push_front(&mut self, item: Message)

Adds a message to the front of the multipart.

source

pub fn pop_front(&mut self) -> Option<Message>

Removes the first message from the multipart and returns it, or None if it is empty.

source

pub fn push_back(&mut self, item: Message)

Adds a message to the back of the multipart.

source

pub fn pop_back(&mut self) -> Option<Message>

Removes the last message from the multipart and returns it, or None if it is empty.

source

pub fn iter(&self) -> impl Iterator<Item = &Message>

Creates an iterator which iterates through the messages of this multipart.

source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Message>

Creates an iterator mut which iterates through the mutable messages of this multipart.

Trait Implementations§

source§

impl Debug for Multipart

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Multipart

source§

fn default() -> Multipart

Returns the “default value” for a type. Read more
source§

impl From<Message> for Multipart

source§

fn from(message: Message) -> Self

Converts to this type from the input type.
source§

impl<T: Into<Message>> From<Vec<T, Global>> for Multipart

source§

fn from(item: Vec<T>) -> Self

Converts to this type from the input type.
source§

impl FromIterator<Message> for Multipart

source§

fn from_iter<T: IntoIterator<Item = Message>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl Index<usize> for Multipart

§

type Output = Message

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<usize> for Multipart

source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl IntoIterator for Multipart

§

type Item = Message

The type of the elements being iterated over.
§

type IntoIter = IntoIter<<Multipart as IntoIterator>::Item, Global>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq<Multipart> for Multipart

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Multipart

source§

impl StructuralEq for Multipart

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.