From 3efe5c3426a311b6d617f9718b82e9a598dfa06d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 15 Jun 2021 22:49:00 +0300 Subject: internal: add future to minicore --- crates/test_utils/src/minicore.rs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'crates/test_utils/src') diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs index 8c0d122dc..127d06e59 100644 --- a/crates/test_utils/src/minicore.rs +++ b/crates/test_utils/src/minicore.rs @@ -14,6 +14,8 @@ //! unsize: sized //! deref: sized //! coerce_unsized: unsize +//! pin: +//! future: pin pub mod marker { // region:sized @@ -113,6 +115,41 @@ pub mod slice { } // endregion:slice +// region:pin +pub mod pin { + #[lang = "pin"] + #[fundamental] + pub struct Pin

{ + pointer: P, + } +} +// endregion:pin + +// region:future +pub mod future { + use crate::{pin::Pin, task::{Poll, Context}}; + + #[lang = "future_trait"] + pub trait Future { + type Output; + #[lang = "poll"] + fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll; + } +} +pub mod task { + pub enum Poll { + #[lang = "Ready"] + Ready(T), + #[lang = "Pending"] + Pending, + } + + pub struct Context<'a> { + waker: &'a (), + } +} +// endregion:future + pub mod prelude { pub mod v1 { pub use crate::marker::Sized; // :sized -- cgit v1.2.3