Struct Once
pub struct Once<T> { pub(in ::iter::sources::once) inner: IntoIter<T> }
An iterator that yields an element exactly once.
This struct is created by the [once()] function. See its documentation for more.
Fields
inner: IntoIter<T>
Trait Implementations
impl<T> DoubleEndedIterator for Once<T>
fn next_back(&mut self) -> Option<T>
impl<T> ExactSizeIterator for Once<T>
fn len(&self) -> usize
impl<T> FusedIterator for Once<T>
impl<T> Iterator for Once<T>
type Item = T;fn next(&mut self) -> Option<T>fn size_hint(&self) -> (usize, Option<usize>)
impl<T> OneShot for Once<T>
impl<T> TrustedLen for Once<T>
impl<T: Clone> Clone for Once<T>
fn clone(&self) -> Once<T>
impl<T: Debug> Debug for Once<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<T> Freeze for Once<T>
where
IntoIter<T>: Freeze,
impl<T> RefUnwindSafe for Once<T>
where
IntoIter<T>: RefUnwindSafe,
impl<T> Send for Once<T>
where
IntoIter<T>: Send,
impl<T> Sync for Once<T>
where
IntoIter<T>: Sync,
impl<T> Unpin for Once<T>
where
IntoIter<T>: Unpin,
impl<T> UnsafeUnpin for Once<T>
where
IntoIter<T>: UnsafeUnpin,
impl<T> UnwindSafe for Once<T>
where
IntoIter<T>: UnwindSafe,
Blanket Implementations
impl<I> IntoIterator for Once<T>
where
I: Iterator,
type Item = <I as Iterator>::Item;type IntoIter = I;fn into_iter(self) -> I
impl<T> Any for Once<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Once<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Once<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Once<T>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Once<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Once<T>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Once<T>
impl<T, U> Into<U> for Once<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Once<T>
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 Once<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>