framehop/x86_64/
cache.rs

1use super::unwind_rule::*;
2use crate::cache::*;
3
4/// The unwinder cache type for [`UnwinderX86_64`](super::UnwinderX86_64).
5pub struct CacheX86_64<P: AllocationPolicy = MayAllocateDuringUnwind>(
6    pub Cache<UnwindRuleX86_64, P>,
7);
8
9impl CacheX86_64<MayAllocateDuringUnwind> {
10    /// Create a new cache.
11    pub fn new() -> Self {
12        Self(Cache::new())
13    }
14}
15
16impl<P: AllocationPolicy> CacheX86_64<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 CacheX86_64<P> {
29    fn default() -> Self {
30        Self::new_in()
31    }
32}