}
}
-pub mod iter {
- pub use self::traits::{collect::IntoIterator, iterator::Iterator};
- mod traits {
- pub(crate) mod iterator {
- use crate::option::Option;
- pub trait Iterator {
- type Item;
- fn next(&mut self) -> Option<Self::Item>;
- fn by_ref(&mut self) -> &mut Self {
- self
- }
- fn take(self, n: usize) -> crate::iter::Take<Self> {
- crate::iter::Take { inner: self }
- }
- }
-
- impl<I: Iterator> Iterator for &mut I {
- type Item = I::Item;
- fn next(&mut self) -> Option<I::Item> {
- (**self).next()
- }
- }
- }
- pub(crate) mod collect {
- pub trait IntoIterator {
- type Item;
- }
- }
- }
-
- pub use self::sources::*;
- pub(crate) mod sources {
- use super::Iterator;
- use crate::option::Option::{self, *};
- pub struct Repeat<A> {
- element: A,
- }
-
- pub fn repeat<T>(elt: T) -> Repeat<T> {
- Repeat { element: elt }
- }
-
- impl<A> Iterator for Repeat<A> {
- type Item = A;
-
- fn next(&mut self) -> Option<A> {
- None
- }
- }
- }
-
- pub use self::adapters::*;
- pub(crate) mod adapters {
- use super::Iterator;
- use crate::option::Option::{self, *};
- pub struct Take<I> {
- pub(crate) inner: I,
- }
- impl<I> Iterator for Take<I>
- where
- I: Iterator,
- {
- type Item = <I as Iterator>::Item;
- fn next(&mut self) -> Option<<I as Iterator>::Item> {
- None
- }
- }
- }
-}
-
-pub mod ops {
- #[lang = "fn"]
- pub trait Fn<Args>: FnMut<Args> {
- extern "rust-call" fn call(&self, args: Args) -> Self::Output;
- }
-
- #[lang = "fn_mut"]
- pub trait FnMut<Args>: FnOnce<Args> {
- extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
- }
- #[lang = "fn_once"]
- pub trait FnOnce<Args> {
- #[lang = "fn_once_output"]
- type Output;
- extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
- }
-
- #[lang = "deref"]
- pub trait Deref {
- type Target: ?Sized;
- fn deref(&self) -> &Self::Target;
- }
-}
-
pub mod option {
pub enum Option<T> {
None,