Struct OnceWith

pub struct OnceWith<F> { pub(in ::iter::sources::once_with) make: Option<F> }

An iterator that yields a single element of type A by applying the provided closure F: FnOnce() -> A.

This struct is created by the [once_with()] function. See its documentation for more.

Fields

make: Option<F>

Trait Implementations

impl<A, F: FnOnce() -> A> DoubleEndedIterator for OnceWith<F>

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

impl<A, F: FnOnce() -> A> ExactSizeIterator for OnceWith<F>

fn len(&self) -> usize

impl<A, F: FnOnce() -> A> FusedIterator for OnceWith<F>

impl<A, F: FnOnce() -> A> Iterator for OnceWith<F>

type Item = A;
fn next(&mut self) -> Option<A>
fn size_hint(&self) -> (usize, Option<usize>)

impl<A, F: FnOnce() -> A> TrustedLen for OnceWith<F>

impl<F> Debug for OnceWith<F>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<F> OneShot for OnceWith<F>

impl<F: Clone> Clone for OnceWith<F>

fn clone(&self) -> OnceWith<F>

Auto Trait Implementations

impl<F> Freeze for OnceWith<F> where Option<F>: Freeze,

impl<F> RefUnwindSafe for OnceWith<F> where Option<F>: RefUnwindSafe,

impl<F> Send for OnceWith<F> where Option<F>: Send,

impl<F> Sync for OnceWith<F> where Option<F>: Sync,

impl<F> Unpin for OnceWith<F> where Option<F>: Unpin,

impl<F> UnsafeUnpin for OnceWith<F> where Option<F>: UnsafeUnpin,

impl<F> UnwindSafe for OnceWith<F> where Option<F>: UnwindSafe,

Blanket Implementations

impl<I> IntoIterator for OnceWith<F> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

impl<T> Any for OnceWith<F> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for OnceWith<F> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for OnceWith<F> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for OnceWith<F> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for OnceWith<F>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for OnceWith<F> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for OnceWith<F>

impl<T, U> Into<U> for OnceWith<F> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for OnceWith<F> where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for OnceWith<F> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>