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>)
| 169 | /// a `defer:` error — the TS side's routine "take the wasm path" signal — |
| 170 | /// regardless of what the truncated walk produced. |
| 171 | pub 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)] |
| 183 | mod tests { |