-
Notifications
You must be signed in to change notification settings - Fork 341
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
Some functions in future module to no_std #696
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
use std::pin::Pin; | ||
use std::future::Future; | ||
use core::future::Future; | ||
use core::pin::Pin; | ||
|
||
use crate::task::{Context, Poll}; | ||
|
||
|
@@ -23,15 +23,18 @@ use crate::task::{Context, Poll}; | |
/// # | ||
/// # }) | ||
/// ``` | ||
pub async fn poll_fn<F, T>(f: F) -> T | ||
k-nasa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pub fn poll_fn<F, T>(f: F) -> PollFn<F> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I'm so-so about this change. Functions such as With async await for embedded rust steadily progressing, I wonder how needed this is. It seems as async/await continues to move beyond mvp status this will be much of a non-issue. All in all I think it'd be okay to leave these methods as-is for now. Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, the feature won't make the cut in 6 days, so it's at least 18 weeks out. Given that this is no user-visible change, I'd be fine with enabling embrio users to use this currently. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the interface seen from the user does not change, I think that it is OK to change this. |
||
where | ||
F: FnMut(&mut Context<'_>) -> Poll<T>, | ||
{ | ||
let fut = PollFn { f }; | ||
fut.await | ||
PollFn { f } | ||
} | ||
|
||
struct PollFn<F> { | ||
/// This future is constructed by the [`poll_fn`] function. | ||
/// | ||
/// [`poll_fn`]: fn.poll_fn.html | ||
#[derive(Debug)] | ||
pub struct PollFn<F> { | ||
f: F, | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe
ready
should be able to work in no-std.