Skip to main content

FrameMap

Trait FrameMap 

Source
pub trait FrameMap {
    type ExistingEntry<'a>: FrameMapOccupiedEntry
       where Self: 'a;
    type VacantEntry<'a>: FrameMapVacantEntry
       where Self: 'a;

    // Required methods
    fn with_capacity(capacity: usize) -> Self;
    fn entry(
        &mut self,
        frame_id: FrameId,
    ) -> FrameMapEntry<Self::ExistingEntry<'_>, Self::VacantEntry<'_>>;
    fn len(&self) -> usize;
    fn retain(&mut self, f: impl FnMut(&FrameId, &mut FrameBuilder) -> bool);

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

An abstraction of a Hash Map, suitable for reassembling frames.

Required Associated Types§

Source

type ExistingEntry<'a>: FrameMapOccupiedEntry where Self: 'a

Source

type VacantEntry<'a>: FrameMapVacantEntry where Self: 'a

Required Methods§

Source

fn with_capacity(capacity: usize) -> Self

Creates a new map with the given capacity.

Source

fn entry( &mut self, frame_id: FrameId, ) -> FrameMapEntry<Self::ExistingEntry<'_>, Self::VacantEntry<'_>>

Returns the FrameMapEntry API for a vacant or existing entry.

Source

fn len(&self) -> usize

Number of elements in the map.

Source

fn retain(&mut self, f: impl FnMut(&FrameId, &mut FrameBuilder) -> bool)

Removes all elements from the map, for which the given predicate evaluates to false.

Provided Methods§

Source

fn is_empty(&self) -> bool

Indicates whether the map is empty.

Defaults to check if the FrameMap::len is 0.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl FrameMap for FrameDashMap

Source§

type ExistingEntry<'a> = OccupiedEntry<'a, u32, FrameBuilder>

Source§

type VacantEntry<'a> = VacantEntry<'a, u32, FrameBuilder>

Source§

impl FrameMap for FrameHashMap

Available on crate feature hashbrown only.
Source§

type ExistingEntry<'a> = OccupiedEntry<'a, u32, FrameBuilder>

Source§

type VacantEntry<'a> = VacantEntry<'a, u32, FrameBuilder>