From 1d0c44fb255f5fbf5a03e7c737e40ab66d39de9e Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 Feb 2023 01:24:27 +0100 Subject: Implement basic text caching in `iced_wgpu` --- core/src/font.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'core') diff --git a/core/src/font.rs b/core/src/font.rs index 3f9ad2b5..130e378e 100644 --- a/core/src/font.rs +++ b/core/src/font.rs @@ -1,3 +1,5 @@ +use std::hash::{Hash, Hasher}; + /// A font. #[derive(Debug, Clone, Copy)] pub enum Font { @@ -22,3 +24,17 @@ impl Default for Font { Font::Default } } + +impl Hash for Font { + fn hash(&self, hasher: &mut H) { + match self { + Self::Default => { + 0.hash(hasher); + } + Self::External { name, .. } => { + 1.hash(hasher); + name.hash(hasher); + } + } + } +} -- cgit