Enum DefinitionMap

Source
pub enum DefinitionMap<'a> {
    Ref(&'a [Definition]),
    Mut(&'a mut [Definition]),
}
Expand description

Map of function number or opcode to code definitions.

The Ref vs Mut distinction exists because these can be modified from the font and control value programs but not from a glyph program. In addition, hinting instance state is immutable once initialized so this captures that in a type safe way.

Variants§

§

Ref(&'a [Definition])

§

Mut(&'a mut [Definition])

Implementations§

Source§

impl DefinitionMap<'_>

Source

pub fn allocate(&mut self, key: i32) -> Result<&mut Definition, HintErrorKind>

Attempts to allocate a new definition entry with the given key.

Overriding a definition is legal, so if an existing active entry is found with the same key, that one will be returned. Otherwise, an inactive entry will be chosen.

Source

pub fn get(&self, key: i32) -> Result<&Definition, HintErrorKind>

Returns the definition with the given key.

Source

pub fn reset(&mut self)

If the map is mutable, resets all definitions to the default value.

Auto Trait Implementations§

§

impl<'a> Freeze for DefinitionMap<'a>

§

impl<'a> RefUnwindSafe for DefinitionMap<'a>

§

impl<'a> Send for DefinitionMap<'a>

§

impl<'a> Sync for DefinitionMap<'a>

§

impl<'a> Unpin for DefinitionMap<'a>

§

impl<'a> !UnwindSafe for DefinitionMap<'a>

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, 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.