Struct 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>> 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

Source§

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

Source§

type Item = Message

The type of the elements being iterated over.
Source§

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

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 for Multipart

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Multipart

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.