Skip to main content

EitherPartition

Struct EitherPartition 

Source
pub struct EitherPartition<L, R> {
    pub lefts: Vec<L>,
    pub rights: Vec<R>,
}
Expand description

A partition result holding separated Left and Right values from a collection.

Fields§

§lefts: Vec<L>

All Left values collected from the input.

§rights: Vec<R>

All Right values collected from the input.

Implementations§

Source§

impl<L, R> EitherPartition<L, R>

Source

pub fn from_iter<I: IntoIterator<Item = OxiEither<L, R>>>(iter: I) -> Self

Partition an iterator of OxiEither values into lefts and rights.

Source

pub fn total(&self) -> usize

Returns the total count of collected items.

Source

pub fn no_lefts(&self) -> bool

Returns true if there are no Left values.

Source

pub fn no_rights(&self) -> bool

Returns true if there are no Right values.

Source

pub fn left_ratio(&self) -> f64

Returns the ratio of lefts to total (0.0 if empty).

Auto Trait Implementations§

§

impl<L, R> Freeze for EitherPartition<L, R>

§

impl<L, R> RefUnwindSafe for EitherPartition<L, R>

§

impl<L, R> Send for EitherPartition<L, R>
where L: Send, R: Send,

§

impl<L, R> Sync for EitherPartition<L, R>
where L: Sync, R: Sync,

§

impl<L, R> Unpin for EitherPartition<L, R>
where L: Unpin, R: Unpin,

§

impl<L, R> UnsafeUnpin for EitherPartition<L, R>

§

impl<L, R> UnwindSafe for EitherPartition<L, R>
where L: UnwindSafe, R: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.