MCPcopy Create free account
hub / github.com/argumentcomputer/ix / decode_name

Function decode_name

crates/ffi/src/lean_env.rs:597–620  ·  view source on GitHub ↗

Name decoding with global cache

(obj: LeanBorrowed<'_>, global: &GlobalCache)

Source from the content-addressed store, hash-verified

595}
596
597impl GlobalCache {
598 fn new() -> Self {
599 Self { names: DashMap::new() }
600 }
601
602 fn with_capacity(capacity: usize) -> Self {
603 Self { names: DashMap::with_capacity(capacity) }
604 }
605}
606
607// SAFETY: The raw pointers are only used as keys for identity comparison.
608// The underlying Lean memory remains valid for the duration of decoding.
609unsafe impl Send for GlobalCache {}
610unsafe impl Sync for GlobalCache {}
611
612/// Thread-local cache for Levels and Exprs.
613#[derive(Default)]
614struct LocalCache {
615 univs: FxHashMap<*mut lean_ffi::include::lean_object, Level>,
616 exprs: FxHashMap<*mut lean_ffi::include::lean_object, Expr>,
617}
618
619// SAFETY: LocalCache is only accessed by a single thread.
620unsafe impl Send for LocalCache {}
621
622/// Combined cache reference passed to decoding functions.
623pub struct Cache<'g> {

Callers 15

decode_name_arrayFunction · 0.85
decode_levelFunction · 0.85
decode_syntaxFunction · 0.85
decode_name_data_valueFunction · 0.85
decode_exprFunction · 0.85
decode_recursor_ruleFunction · 0.85
decode_constant_valFunction · 0.85
decode_constant_infoFunction · 0.85
rs_test_ffi_roundtripFunction · 0.85
rs_compare_blockFunction · 0.85

Calls 4

tagMethod · 0.80
entryMethod · 0.80
getMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected