diff options
author | Aleksey Kladov <[email protected]> | 2021-06-16 20:48:48 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-06-16 20:48:48 +0100 |
commit | 604267088c9ef6afa021807b437dab22d72dfc99 (patch) | |
tree | a98a495f7d24f943541f50c8d21f22ff3460729d /crates/test_utils/src | |
parent | 7ba5482a04e2534890b85cf832616a08c1b1bf21 (diff) |
internal: add iterator to minicore
Diffstat (limited to 'crates/test_utils/src')
-rw-r--r-- | crates/test_utils/src/minicore.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs index e04ca58d2..011d460be 100644 --- a/crates/test_utils/src/minicore.rs +++ b/crates/test_utils/src/minicore.rs | |||
@@ -20,6 +20,7 @@ | |||
20 | //! future: pin | 20 | //! future: pin |
21 | //! option: | 21 | //! option: |
22 | //! result: | 22 | //! result: |
23 | //! iterator: option | ||
23 | 24 | ||
24 | pub mod marker { | 25 | pub mod marker { |
25 | // region:sized | 26 | // region:sized |
@@ -206,9 +207,38 @@ pub mod task { | |||
206 | } | 207 | } |
207 | // endregion:future | 208 | // endregion:future |
208 | 209 | ||
210 | // region:iterator | ||
211 | pub mod iter { | ||
212 | mod traits { | ||
213 | mod iterator { | ||
214 | pub trait Iterator { | ||
215 | type Item; | ||
216 | #[lang = "next"] | ||
217 | fn next(&mut self) -> Option<Self::Item>; | ||
218 | fn nth(&mut self, n: usize) -> Option<Self::Item> { | ||
219 | loop {} | ||
220 | } | ||
221 | } | ||
222 | } | ||
223 | mod collect { | ||
224 | pub trait IntoIterator { | ||
225 | type Item; | ||
226 | type IntoIter: Iterator<Item = Self::Item>; | ||
227 | #[lang = "into_iter"] | ||
228 | fn into_iter(self) -> Self::IntoIter; | ||
229 | } | ||
230 | } | ||
231 | pub use self::collect::IntoIterator; | ||
232 | pub use self::iterator::Iterator; | ||
233 | } | ||
234 | pub use self::traits::{IntoIterator, Iterator}; | ||
235 | } | ||
236 | // endregion:iterator | ||
237 | |||
209 | pub mod prelude { | 238 | pub mod prelude { |
210 | pub mod v1 { | 239 | pub mod v1 { |
211 | pub use crate::{ | 240 | pub use crate::{ |
241 | iter::{IntoIterator, Iterator}, // :iterator | ||
212 | marker::Sized, // :sized | 242 | marker::Sized, // :sized |
213 | ops::{Fn, FnMut, FnOnce}, // :fn | 243 | ops::{Fn, FnMut, FnOnce}, // :fn |
214 | option::Option::{self, None, Some}, // :option | 244 | option::Option::{self, None, Some}, // :option |