Skip to content

Commit

Permalink
no need to manual impl default
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhou121 committed Sep 5, 2024
1 parent d9d2a7f commit 0085fdb
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/shape_run_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,13 @@ pub struct ShapeRunKey {
}

/// A helper structure for caching shape runs.
#[derive(Clone)]
#[derive(Clone, Default)]
pub struct ShapeRunCache {
age: u64,
cache: HashMap<ShapeRunKey, (u64, Vec<ShapeGlyph>)>,
age_registries: Vec<HashSet<ShapeRunKey>>,
}

impl Default for ShapeRunCache {
fn default() -> Self {
Self {
age: 0,
cache: Default::default(),
age_registries: vec![HashSet::default()],
}
}
}

impl ShapeRunCache {
/// Get cache item, updating age if found
pub fn get(&mut self, key: &ShapeRunKey) -> Option<&Vec<ShapeGlyph>> {
Expand Down

0 comments on commit 0085fdb

Please sign in to comment.