Fix intradoc link and update issue number
This commit is contained in:
parent
04c74f46f0
commit
7915732714
2 changed files with 9 additions and 8 deletions
|
@ -329,7 +329,7 @@ pub use self::sources::{RepeatWith, repeat_with};
|
|||
pub use self::sources::{Empty, empty};
|
||||
#[stable(feature = "iter_once", since = "1.2.0")]
|
||||
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};
|
||||
#[unstable(feature = "iter_unfold", issue = "55977")]
|
||||
pub use self::sources::{Unfold, unfold, Successors, successors};
|
||||
|
|
|
@ -385,12 +385,12 @@ pub fn once<T>(value: T) -> Once<T> {
|
|||
///
|
||||
/// [`once_with`]: fn.once_with.html
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
#[unstable(feature = "iter_once_with", issue = "0")]
|
||||
#[unstable(feature = "iter_once_with", issue = "57581")]
|
||||
pub struct OnceWith<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> {
|
||||
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> {
|
||||
fn next_back(&mut self) -> Option<A> {
|
||||
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> {
|
||||
fn len(&self) -> usize {
|
||||
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> {}
|
||||
|
||||
#[unstable(feature = "iter_once_with", issue = "0")]
|
||||
#[unstable(feature = "iter_once_with", issue = "57581")]
|
||||
unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {}
|
||||
|
||||
/// 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.
|
||||
///
|
||||
/// [`once`]: fn.once.html
|
||||
/// [`chain`]: trait.Iterator.html#method.chain
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -480,7 +481,7 @@ unsafe impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F> {}
|
|||
/// }
|
||||
/// ```
|
||||
#[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> {
|
||||
OnceWith { gen: Some(gen) }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue