mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
internal: add iterator to minicore
This commit is contained in:
parent
7ba5482a04
commit
604267088c
2 changed files with 38 additions and 39 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue