Implement basic text caching in iced_wgpu
This commit is contained in:
parent
032e860f13
commit
1d0c44fb25
3 changed files with 157 additions and 58 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue