Module selfless_reify

Abstraction for creating fn pointers from any callable that effectively has the equivalent of implementing Default, even if the compiler neither provides Default nor allows reifying closures (i.e. creating fn pointers) other than those with absolutely no captures.

More specifically, for a closure-like type to be "effectively Default":

A more flexible (and safer) solution to the general problem could exist once const-generic parameters can have type parameters in their types:

extern "C" fn ffi_wrapper<
    A, R,
    F: Fn(A) -> R,
    const f: F, // <-- this `const`-generic is not yet allowed
>(arg: A) -> R {
    f(arg)
}

Functions