internal: add iterator to minicore
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
//! future: pin
|
||||
//! option:
|
||||
//! result:
|
||||
//! iterator: option
|
||||
|
||||
pub mod marker {
|
||||
// region:sized
|
||||
@@ -206,9 +207,38 @@ pub mod task {
|
||||
}
|
||||
// endregion:future
|
||||
|
||||
// region:iterator
|
||||
pub mod iter {
|
||||
mod traits {
|
||||
mod iterator {
|
||||
pub trait Iterator {
|
||||
type Item;
|
||||
#[lang = "next"]
|
||||
fn next(&mut self) -> Option<Self::Item>;
|
||||
fn nth(&mut self, n: usize) -> Option<Self::Item> {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
}
|
||||
mod collect {
|
||||
pub trait IntoIterator {
|
||||
type Item;
|
||||
type IntoIter: Iterator<Item = Self::Item>;
|
||||
#[lang = "into_iter"]
|
||||
fn into_iter(self) -> Self::IntoIter;
|
||||
}
|
||||
}
|
||||
pub use self::collect::IntoIterator;
|
||||
pub use self::iterator::Iterator;
|
||||
}
|
||||
pub use self::traits::{IntoIterator, Iterator};
|
||||
}
|
||||
// endregion:iterator
|
||||
|
||||
pub mod prelude {
|
||||
pub mod v1 {
|
||||
pub use crate::{
|
||||
iter::{IntoIterator, Iterator}, // :iterator
|
||||
marker::Sized, // :sized
|
||||
ops::{Fn, FnMut, FnOnce}, // :fn
|
||||
option::Option::{self, None, Some}, // :option
|
||||
|
||||
Reference in New Issue
Block a user