Bundle

Struct Bundle 

Source
pub struct Bundle { /* private fields */ }
Expand description

A bundle is a sequence of packets that are used to store elements. Elements of various types, like regular elements, requests or replies can be simply added and the number of packets contained in this bundle is automatically adjusted if no more space is available.

Functions that are used to add elements provide a builder-like structure by returning a mutable reference to itself.

Implementations§

Source§

impl Bundle

Source

pub fn new() -> Bundle

Construct a new empty bundle, this bundle doesn’t allocate until you add the first element.

Source

pub fn with_single(packet: Box<Packet>) -> Self

Create a new bundle with one predefined packet.

Source

pub fn with_multiple(packets: Vec<Box<Packet>>) -> Self

Create a new bundle with multiple predefined packets.

Source

pub fn element_reader(&self) -> BundleElementReader<'_>

Source

pub fn element_writer(&mut self) -> BundleElementWriter<'_>

Source

pub fn len(&self) -> usize

Return the number of packets in this bundle.

Source

pub fn is_empty(&self) -> bool

Source

pub fn clear(&mut self)

Clear the bundle by removing all packets.

Source

pub fn packets(&self) -> &[Box<Packet>]

Get a slice of all packets of this bundle.

Source

pub fn packets_mut(&mut self) -> &mut [Box<Packet>]

Trait Implementations§

Source§

impl Debug for Bundle

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Bundle

§

impl RefUnwindSafe for Bundle

§

impl Send for Bundle

§

impl Sync for Bundle

§

impl Unpin for Bundle

§

impl UnwindSafe for Bundle

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V