Struct core::iter::sources::repeat_n::RepeatN

source ·
pub struct RepeatN<A> {
    count: usize,
    element: ManuallyDrop<A>,
}
🔬This is a nightly-only experimental API. (iter_repeat_n #104434)
Expand description

An iterator that repeats an element an exact number of times.

This struct is created by the repeat_n() function. See its documentation for more.

Fields§

§count: usize
🔬This is a nightly-only experimental API. (iter_repeat_n #104434)
§element: ManuallyDrop<A>
🔬This is a nightly-only experimental API. (iter_repeat_n #104434)

Implementations§

source§

impl<A> RepeatN<A>

source

fn take_element(&mut self) -> Option<A>

If we haven’t already dropped the element, return it in an option.

Clears the count so it won’t be dropped again later.