Skip to main content

Module panic

Module panic 

Source
Expand description

Keeping Rust panics from crossing the C boundary.

Unwinding out of an extern "C" function into C is undefined behaviour. Every entry point in this crate therefore runs its body inside guard, which catches any panic, reports it once, and returns the caller-supplied fallback value instead.

This is a backstop, not a design: a panic reaching here is a bug in the engine. It is reported to stderr on first occurrence so the bug is visible rather than silently swallowed.

Functionsยง

guard
Run body, returning fallback if it panics.