framehop/aarch64/
cache.rs

1use super::unwind_rule::*;
2use crate::cache::*;
3
4/// The unwinder cache type for [`UnwinderAarch64`](super::UnwinderAarch64).
5pub struct CacheAarch64<P: AllocationPolicy = MayAllocateDuringUnwind>(
6    pub Cache<UnwindRuleAarch64, P>,
7);
8
9impl CacheAarch64<MayAllocateDuringUnwind> {
10    /// Create a new cache.
11    pub fn new() -> Self {
12        Self(Cache::new())
13    }
14}
15
16impl<P: AllocationPolicy> CacheAarch64<P> {
17    /// Create a new cache.
18    pub fn new_in() -> Self {
19        Self(Cache::new())
20    }
21
22    /// Returns a snapshot of the cache usage statistics.
23    pub fn stats(&self) -> CacheStats {
24        self.0.rule_cache.stats()
25    }
26}
27
28impl<P: AllocationPolicy> Default for CacheAarch64<P> {
29    fn default() -> Self {
30        Self::new_in()
31    }
32}