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

Function rs_refcount_roundtrip_loop

crates/ffi/src/refcount.rs:154–167  ·  view source on GitHub ↗
(
  name: LeanIxName<LeanBorrowed<'_>>,
  n: usize,
)

Source from the content-addressed store, hash-verified

152/// Roundtrip an Ix.Name N times. Each iteration: decode → build → drop old.
153#[unsafe(no_mangle)]
154pub extern "C" fn rs_refcount_roundtrip_loop(
155 name: LeanIxName<LeanBorrowed<'_>>,
156 n: usize,
157) -> LeanIxName<LeanOwned> {
158 let mut rust_name = name.decode();
159 for _ in 0..n {
160 let mut cache = LeanBuildCache::new();
161 let lean_name = LeanIxName::build(&mut cache, &rust_name);
162 rust_name = lean_name.decode();
163 // lean_name dropped here → lean_dec_ref
164 }
165 let mut cache = LeanBuildCache::new();
166 LeanIxName::build(&mut cache, &rust_name)
167}
168
169// =============================================================================
170// Nested collection traversal with borrows

Callers

nothing calls this directly

Calls 1

decodeMethod · 0.45

Tested by

no test coverage detected