foundationdb-rs
foundationdb-rs copied to clipboard
Safe alternative to "boot"
The documentation says "boot" is unsafe because it can't guarantee that the return value is dropped. The typical solution to this in Rust is to have the function take a closure.
fn run<R>(f: impl FnOnce() -> R) -> R;
Unfortunately this doesn't work for async functions, since you can't stop the return future being leaked, but you could add an attribute like #[foundationdb::main]
that can be combined with eg. #[tokio::main]
.