1 //- /libcore.rs crate:core
2 //! Signatures of traits, types and functions from the core lib for use in tests.
16 pub use self::traits::{collect::IntoIterator, iterator::Iterator};
18 pub(crate) mod iterator {
19 use crate::option::Option;
22 fn next(&mut self) -> Option<Self::Item>;
23 fn by_ref(&mut self) -> &mut Self {
26 fn take(self, n: usize) -> crate::iter::Take<Self> {
27 crate::iter::Take { inner: self }
31 impl<I: Iterator> Iterator for &mut I {
33 fn next(&mut self) -> Option<I::Item> {
38 pub(crate) mod collect {
39 pub trait IntoIterator {
45 pub use self::sources::*;
46 pub(crate) mod sources {
48 use crate::option::Option::{self, *};
49 pub struct Repeat<A> {
53 pub fn repeat<T>(elt: T) -> Repeat<T> {
54 Repeat { element: elt }
57 impl<A> Iterator for Repeat<A> {
60 fn next(&mut self) -> Option<A> {
66 pub use self::adapters::*;
67 pub(crate) mod adapters {
69 use crate::option::Option::{self, *};
73 impl<I> Iterator for Take<I>
77 type Item = <I as Iterator>::Item;
78 fn next(&mut self) -> Option<<I as Iterator>::Item> {
87 pub trait Fn<Args>: FnMut<Args> {
88 extern "rust-call" fn call(&self, args: Args) -> Self::Output;
92 pub trait FnMut<Args>: FnOnce<Args> {
93 extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
96 pub trait FnOnce<Args> {
97 #[lang = "fn_once_output"]
99 extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
114 iter::{IntoIterator, Iterator},
115 ops::{Fn, FnMut, FnOnce},
116 option::Option::{self, *},