Struct IntMap

Source
pub struct IntMap<T> { /* private fields */ }
Expand description

A mapping from a u8 to T.

Printer capabilities represented with this type will generally involve sending a key in this map as part of a command to the printer. For example, for character fonts, sending [0x1b, b'M'] followed by 0x03 to the printer selects “font D”, and correspondingly, profile.fonts.get(3) will return information about the printer’s “font D”, if it exists.

Implementations§

Source§

impl<T> IntMap<T>

Source

pub const fn empty<'a>() -> &'a Self

An empty IntMap.

Source

pub const fn from_entries(entries: &[(u8, T)]) -> &Self

Create an IntMap from the given map entries.

§Panics

This function will panic if entries is not ordered by the first field of the tuple, or has duplicates.

Source

pub fn get(&self, k: u8) -> Option<&T>

Lookup a value by the given key.

Source

pub fn iter(&self) -> IntMapIter<'_, T>

Returns an iterator over the entries of this map.

Trait Implementations§

Source§

impl<T> AsRef<IntMap<T>> for IntMap<T>

Source§

fn as_ref(&self) -> &IntMap<T>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T> Borrow<IntMap<T>> for OwnedIntMap<T>

Source§

fn borrow(&self) -> &IntMap<T>

Immutably borrows from an owned value. Read more
Source§

impl<T: Debug> Debug for IntMap<T>

Source§

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

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

impl<T> Default for &IntMap<T>

Source§

fn default() -> Self

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

impl<'a, T> IntoIterator for &'a IntMap<T>

Source§

type Item = (u8, &'a T)

The type of the elements being iterated over.
Source§

type IntoIter = IntMapIter<'a, T>

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<T> ToOwned for IntMap<T>

Source§

type Owned = OwnedIntMap<T>

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more

Auto Trait Implementations§

§

impl<T> Freeze for IntMap<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for IntMap<T>
where T: RefUnwindSafe,

§

impl<T> Send for IntMap<T>
where T: Send,

§

impl<T> !Sized for IntMap<T>

§

impl<T> Sync for IntMap<T>
where T: Sync,

§

impl<T> Unpin for IntMap<T>
where T: Unpin,

§

impl<T> UnwindSafe for IntMap<T>
where T: 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