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<'_>
impl DefinitionMap<'_>
Sourcepub fn allocate(&mut self, key: i32) -> Result<&mut Definition, HintErrorKind>
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.
Sourcepub fn get(&self, key: i32) -> Result<&Definition, HintErrorKind>
pub fn get(&self, key: i32) -> Result<&Definition, HintErrorKind>
Returns the definition with the given key.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more