MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / run_guarded

Function run_guarded

codegraph-kernel/src/stack.rs:171–180  ·  view source on GitHub ↗

Run one extraction under the guard. A walk that tripped the guard returns a `defer:` error — the TS side's routine "take the wasm path" signal — regardless of what the truncated walk produced.

(f: impl FnOnce() -> Result<T, String>)

Source from the content-addressed store, hash-verified

169/// a `defer:` error — the TS side's routine "take the wasm path" signal —
170/// regardless of what the truncated walk produced.
171pub fn run_guarded<T>(f: impl FnOnce() -> Result<T, String>) -> Result<T, String> {
172 begin();
173 let out = f();
174 if overflowed() {
175 return Err(
176 "defer: nesting too deep for the native walker — wasm recovery handles it".to_string(),
177 );
178 }
179 out
180}
181
182#[cfg(test)]
183mod tests {

Calls 2

beginFunction · 0.85
overflowedFunction · 0.85