I've been working on some bindings from C to rustls, to be used by curl and Apache. I'm interested in feedback on the library design generally: GitHub - abetterinternet/crustls: C-to-rustls bindings.
I'm also particularly interested in recommendations on how to handle panics: Use catch_unwind to prevent panicking across FFI. by jsha · Pull Request #25 · abetterinternet/crustls · GitHub.
Specifically I have to catch panics and return something (because panics crossing the FFI boundary is UB). For many functions, I return a result enum and can return an error. For functions that are infallible (except for panics), I'm returning default values after recovering from a panic. Is that sensible? Should I make every function fallible in order to account for the possibility of panicking? That seems like bad ergonomics for the users of the library.