Trait stats::Commute

source ·
pub trait Commute: Sized {
    // Required method
    fn merge(&mut self, other: Self);

    // Provided method
    fn consume<I: Iterator<Item = Self>>(&mut self, other: I) { ... }
}
Expand description

Defines an interface for types that have an identity and can be commuted.

The value returned by Default::default must be its identity with respect to the merge operation.

Required Methods§

source

fn merge(&mut self, other: Self)

Merges the value other into self.

Provided Methods§

source

fn consume<I: Iterator<Item = Self>>(&mut self, other: I)

Merges the values in the iterator into self.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T: Commute> Commute for Option<T>

source§

fn merge(&mut self, other: Option<T>)

source§

impl<T: Commute> Commute for Vec<T>

source§

fn merge(&mut self, other: Vec<T>)

source§

impl<T: Commute, E> Commute for Result<T, E>

source§

fn merge(&mut self, other: Result<T, E>)

Implementors§