Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safe alternative to "boot" #237

Open
Diggsey opened this issue Sep 12, 2021 · 0 comments
Open

Safe alternative to "boot" #237

Diggsey opened this issue Sep 12, 2021 · 0 comments

Comments

@Diggsey
Copy link

Diggsey commented Sep 12, 2021

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].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant