Struct Position

pub struct Position { pub is_first: bool, pub is_last: bool }

The first component of the value yielded by WithPosition. Indicates the position of this element in the iterator results.

See .with_position() for more information.

Fields

is_first: bool

This is the initial element (also true if there's exactly one element)

is_last: bool

This is the final element (also true if there's exactly one element)

Implementations

impl Position

fn is_exactly_one(self) -> bool

This is the first and the last element at the same time, and there are no more elements

fn is_middle(self) -> bool

This is neither first nor last element, and there will be more elements

fn is_first(self) -> bool

This is the initial element (also true if there's exactly one element)

fn is_last(self) -> bool

This is the final element (also true if there's exactly one element)

Trait Implementations

impl Clone for Position

fn clone(&self) -> Position

impl Copy for Position

impl Debug for Position

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

impl Eq for Position

impl PartialEq for Position

fn eq(&self, other: &Position) -> bool

impl StructuralPartialEq for Position

Auto Trait Implementations

impl Freeze for Position

impl RefUnwindSafe for Position

impl Send for Position

impl Sync for Position

impl Unpin for Position

impl UnsafeUnpin for Position

impl UnwindSafe for Position

Blanket Implementations

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Position where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Position where T: ?Sized,

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

impl<T> CloneToUninit for Position where T: Clone,

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

impl<T> From<T> for Position

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> IntoEither for Position

impl<T> ToOwned for Position where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Position 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 Position where U: Into<T>,

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

impl<T, U> TryInto<U> for Position where U: TryFrom<T>,

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