pub struct FontInstanceKeyMap(Arc<RwLock<FontInstanceKeyMapLocked>>);
Expand description
A map of namespace-local font instance keys to shared keys. Weak references are used to track the liveness of each key mapping as other consumers of BaseFontInstance might hold strong references to the entry. A mapping from BaseFontInstance to the shared key is then used to determine which shared key to assign to that instance. When the weak count of the mapping is zero, the entry is allowed to expire. Again, care must be taken when clearing a namespace within the key map as it may cause shared key expirations that require individual processing. Shared instance keys will be created within the provided unique namespace.
Tuple Fields§
§0: Arc<RwLock<FontInstanceKeyMapLocked>>
Implementations§
source§impl FontInstanceKeyMap
impl FontInstanceKeyMap
pub fn new(namespace: IdNamespace) -> Self
fn lock(&self) -> RwLockReadGuard<'_, FontInstanceKeyMapLocked>
fn lock_mut(&mut self) -> RwLockWriteGuard<'_, FontInstanceKeyMapLocked>
pub fn keys(&self) -> Vec<FontInstanceKey>
pub fn map_key(&self, key: &FontInstanceKey) -> FontInstanceKey
pub fn add_key( &mut self, instance: BaseFontInstance, ) -> Option<Arc<BaseFontInstance>>
pub fn delete_key(&mut self, key: &FontInstanceKey) -> Option<FontInstanceKey>
pub fn clear_namespace( &mut self, namespace: IdNamespace, ) -> Vec<FontInstanceKey>
Trait Implementations§
source§impl Clone for FontInstanceKeyMap
impl Clone for FontInstanceKeyMap
source§fn clone(&self) -> FontInstanceKeyMap
fn clone(&self) -> FontInstanceKeyMap
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for FontInstanceKeyMap
impl RefUnwindSafe for FontInstanceKeyMap
impl Send for FontInstanceKeyMap
impl Sync for FontInstanceKeyMap
impl Unpin for FontInstanceKeyMap
impl UnwindSafe for FontInstanceKeyMap
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more