Struct SliceMap

Source
pub struct SliceMap<K, V>
where K: TypedIndex,
{ /* private fields */ }
Expand description

This is a dynamically-sized slice that can only be indexed by the correct index type.

Implementations§

Source§

impl<K, V> SliceMap<K, V>
where K: TypedIndex,

Source

pub fn get(&self, index: K) -> Option<&V>

Gets a reference to the value at the given index.

Source

pub fn get_mut(&mut self, index: K) -> Option<&mut V>

Gets a mutable reference to the value at the given index.

Source

pub fn len(&self) -> usize

Gets the length of this slice map.

Source

pub fn iter(&self) -> Iter<'_, K, V>

Returns an iterator for this slice map.

Source

pub fn iter_mut(&mut self) -> IterMut<'_, K, V>

Returns a mutable iterator for this slice map.

Source

pub fn as_ptr(&self) -> *const V

Gets a pointer to the SliceMap.

Source

pub fn as_mut_ptr(&mut self) -> *mut V

Gets a mutable pointer to the SliceMap.

Trait Implementations§

Source§

impl<K, V: Debug> Debug for SliceMap<K, V>
where K: TypedIndex + Debug,

Source§

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

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

impl<K, V> Index<K> for SliceMap<K, V>
where K: TypedIndex,

Source§

type Output = V

The returned type after indexing.
Source§

fn index(&self, index: K) -> &V

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

impl<K, V> IndexMut<K> for SliceMap<K, V>
where K: TypedIndex,

Source§

fn index_mut(&mut self, index: K) -> &mut V

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

Auto Trait Implementations§

§

impl<K, V> Freeze for SliceMap<K, V>
where V: Freeze,

§

impl<K, V> RefUnwindSafe for SliceMap<K, V>

§

impl<K, V> Send for SliceMap<K, V>
where K: Send, V: Send,

§

impl<K, V> !Sized for SliceMap<K, V>

§

impl<K, V> Sync for SliceMap<K, V>
where K: Sync, V: Sync,

§

impl<K, V> Unpin for SliceMap<K, V>
where K: Unpin, V: Unpin,

§

impl<K, V> UnwindSafe for SliceMap<K, V>
where K: UnwindSafe, V: UnwindSafe,

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