1
Fork 0

Fix intradoc link and update issue number

This commit is contained in:
Stjepan Glavina 2019-01-13 21:24:15 +01:00
parent 04c74f46f0
commit 7915732714
2 changed files with 9 additions and 8 deletions

View file

@ -329,7 +329,7 @@ pub use self::sources::{RepeatWith, repeat_with};
pub use self::sources::{Empty, empty}; pub use self::sources::{Empty, empty};
#[stable(feature = "iter_once", since = "1.2.0")] #[stable(feature = "iter_once", since = "1.2.0")]
pub use self::sources::{Once, once}; pub use self::sources::{Once, once};
#[unstable(feature = "iter_once_with", issue = "0")] #[unstable(feature = "iter_once_with", issue = "57581")]
pub use self::sources::{OnceWith, once_with}; pub use self::sources::{OnceWith, once_with};
#[unstable(feature = "iter_unfold", issue = "55977")] #[unstable(feature = "iter_unfold", issue = "55977")]
pub use self::sources::{Unfold, unfold, Successors, successors}; pub use self::sources::{Unfold, unfold, Successors, successors};

View file

@ -385,12 +385,12 @@ pub fn once<T>(value: T) -> Once<T> {
/// ///
/// [`once_with`]: fn.once_with.html /// [`once_with`]: fn.once_with.html
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
#[unstable(feature = "iter_once_with", issue = "0")] #[unstable(feature = "iter_once_with", issue = "57581")]
pub struct OnceWith<F> { pub struct OnceWith<F> {
gen: Option<F>, gen: Option<F>,
} }
#[unstable(feature = "iter_once_with", issue = "0")] #[unstable(feature = "iter_once_with", issue = "57581")]
impl<A, F: FnOnce() -> A> Iterator for OnceWith<F> { impl<A, F: FnOnce() -> A> Iterator for OnceWith<F> {
type Item = A; type Item = A;
@ -405,24 +405,24 @@ impl<A, F: FnOnce() -> A> Iterator for OnceWith<F> {
} }
} }
#[unstable(feature = "iter_once_with", issue = "0")] #[unstable(feature = "iter_once_with", issue = "57581")]
impl<A, F: FnOnce() -> A> DoubleEndedIterator for OnceWith<F> { impl<A, F: FnOnce() -> A> DoubleEndedIterator for OnceWith<F> {
fn next_back(&mut self) -> Option<A> { fn next_back(&mut self) -> Option<A> {
self.next() self.next()
} }
} }
#[unstable(feature = "iter_once_with", issue = "0")] #[unstable(feature = "iter_once_with", issue = "57581")]
impl<A, F: FnOnce() -> A> ExactSizeIterator for OnceWith<F> { impl<A, F: FnOnce() -> A> ExactSizeIterator for OnceWith<F> {
fn len(&self) -> usize { fn len(&self) -> usize {
self.gen.iter().len() self.gen.iter().len()
} }
} }
#[unstable(feature = "iter_once_with", issue = "0")] #[unstable(feature = "iter_once_with", issue = "57581")]
impl<A, F: FnOnce() -> A> FusedIterator for OnceWith<F> {} impl<A, F: FnOnce() -> A> FusedIterator for OnceWith<F> {}
#[unstable(feature = "iter_once_with", issue = "0")] #[unstable(feature = "iter_once_with", issue = "57581")]
unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {} unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {}
/// Creates an iterator that lazily generates a value exactly once by invoking /// Creates an iterator that lazily generates a value exactly once by invoking
@ -436,6 +436,7 @@ unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {}
/// Unlike [`once`], this function will lazily generate the value on request. /// Unlike [`once`], this function will lazily generate the value on request.
/// ///
/// [`once`]: fn.once.html /// [`once`]: fn.once.html
/// [`chain`]: trait.Iterator.html#method.chain
/// ///
/// # Examples /// # Examples
/// ///
@ -480,7 +481,7 @@ unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {}
/// } /// }
/// ``` /// ```
#[inline] #[inline]
#[unstable(feature = "iter_once_with", issue = "0")] #[unstable(feature = "iter_once_with", issue = "57581")]
pub fn once_with<A, F: FnOnce() -> A>(gen: F) -> OnceWith<F> { pub fn once_with<A, F: FnOnce() -> A>(gen: F) -> OnceWith<F> {
OnceWith { gen: Some(gen) } OnceWith { gen: Some(gen) }
} }