diff options
author | 2023-02-02 01:24:27 +0100 | |
---|---|---|
committer | 2023-02-24 13:22:57 +0100 | |
commit | 1d0c44fb255f5fbf5a03e7c737e40ab66d39de9e (patch) | |
tree | 8cc41f70f935ab332864d3c280f864f0dfc4f505 /core/src/font.rs | |
parent | 032e860f13a562719faf128238abe7ffb7f2a610 (diff) | |
download | iced-1d0c44fb255f5fbf5a03e7c737e40ab66d39de9e.tar.gz iced-1d0c44fb255f5fbf5a03e7c737e40ab66d39de9e.tar.bz2 iced-1d0c44fb255f5fbf5a03e7c737e40ab66d39de9e.zip |
Implement basic text caching in `iced_wgpu`
Diffstat (limited to 'core/src/font.rs')
-rw-r--r-- | core/src/font.rs | 16 |
1 files changed, 16 insertions, 0 deletions
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<H: Hasher>(&self, hasher: &mut H) { + match self { + Self::Default => { + 0.hash(hasher); + } + Self::External { name, .. } => { + 1.hash(hasher); + name.hash(hasher); + } + } + } +} |