2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-10-22 12:26:37 +00:00

feat: to no_std future::pending

This commit is contained in:
k-nasa 2020-02-04 17:59:22 +09:00
parent 125fa5b0a0
commit da23d16019

View file

@ -1,6 +1,6 @@
use std::future::Future; use core::future::Future;
use std::marker::PhantomData; use core::marker::PhantomData;
use std::pin::Pin; use core::pin::Pin;
use crate::task::{Context, Poll}; use crate::task::{Context, Poll};
@ -24,14 +24,17 @@ use crate::task::{Context, Poll};
/// # /// #
/// # }) /// # })
/// ``` /// ```
pub async fn pending<T>() -> T { pub fn pending<T>() -> Pending<T> {
let fut = Pending { Pending {
_marker: PhantomData, _marker: PhantomData,
}; }
fut.await
} }
struct Pending<T> { /// This future is constructed by the [`pending`] function.
///
/// [`pending`]: fn.pending.html
#[derive(Debug)]
pub struct Pending<T> {
_marker: PhantomData<T>, _marker: PhantomData<T>,
} }