Skip to content

Exposes tokio guard API (Fixes #34) #39

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ItsSunnyMonster
Copy link

@ItsSunnyMonster ItsSunnyMonster commented Dec 14, 2024

This PR adds a new function which wraps TOKIO1.handle.enter() and fixes #34

I'm not quite sure how to write a good example for its documentation though.

src/lib.rs Outdated
/// provides.
///
/// TODO: Examples
pub fn enter_tokio_runtime() -> EnterGuard<'static> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this wrap a newtype around EnterGuard, I don't want to directly expose the tokio dependency.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that the way entering tokio runtimes works has been changed. Would it be better if this public function entered the runtime for you or would it be better to make a wrapper of get_runtime_handle which returns a newtype and requires the user to call enter on it?

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

Successfully merging this pull request may close these issues.

Expose the guard API to allow users to enter tokio runtime
2 participants