Type Alias Marks

Source
pub type Marks = MarkStorage<Mark>;
Expand description

The 2 marks that can be attached to packets.

Aliased Type§

struct Marks(/* private fields */);

Implementations§

Source§

impl Marks

Source

pub const UNMARKED: Self

Unmarked marks.

Source§

impl<T> MarkStorage<T>

Source

pub fn new<U, IntoIter>(iter: IntoIter) -> Self
where IntoIter: IntoIterator<Item = (MarkDomain, U)>, T: From<Option<U>> + Copy,

Creates MarkStorages from an iterator of (MarkDomain, U).

An unspecified domain will remain default. For the same domain, a later value in the iterator will override an earlier value.

For a specified domain, (Some(value)).into() will be written.

Source

pub fn get(&self, domain: MarkDomain) -> &T

Gets an immutable reference to the mark at the given domain.

Source

pub fn get_mut(&mut self, domain: MarkDomain) -> &mut T

Gets a mutable reference to the mark at the given domain.

Source

pub fn iter(&self) -> impl Iterator<Item = (MarkDomain, &T)>

Returns an iterator over the mark domains.

Source

pub fn zip_with<'a, U>( &'a self, MarkStorage: &'a MarkStorage<U>, ) -> impl Iterator<Item = (MarkDomain, &'a T, &'a U)> + 'a

Zips with another storage so that the domains align.

Trait Implementations

Source§

impl<T: Clone> Clone for MarkStorage<T>

Source§

fn clone(&self) -> MarkStorage<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for MarkStorage<T>

Source§

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

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

impl<T: Default> Default for MarkStorage<T>

Source§

fn default() -> MarkStorage<T>

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

impl<T: PartialEq> PartialEq for MarkStorage<T>

Source§

fn eq(&self, other: &MarkStorage<T>) -> 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<T: Copy> Copy for MarkStorage<T>

Source§

impl<T: Eq> Eq for MarkStorage<T>

Source§

impl<T> StructuralPartialEq for MarkStorage<T>