pub struct ASTCache { /* private fields */ }Expand description
AST 缓存,用于存储已解析的程序。
- 碰撞安全:u64 哈希仅作加速索引,命中前必须比对源码 完全一致,哈希碰撞不会返回错误的 AST。
- LRU 淘汰:
VecDeque维护真实的使用顺序,get 命中会刷新 新鲜度;容量满时淘汰最近最少使用的条目。
Implementations§
Source§impl ASTCache
impl ASTCache
Sourcepub fn with_capacity(max_size: usize) -> Self
pub fn with_capacity(max_size: usize) -> Self
创建指定容量的AST缓存
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
获取缓存统计信息
Trait Implementations§
Auto Trait Implementations§
impl Forget for ASTCache
impl Freeze for ASTCache
impl Move for ASTCache
impl RefUnwindSafe for ASTCache
impl Send for ASTCache
impl Sync for ASTCache
impl Unpin for ASTCache
impl UnsafeUnpin for ASTCache
impl UnwindSafe for ASTCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more