Trait Sum

Source
pub trait Sum<Output> {
    // Required methods
    fn zero() -> Output;
    fn map(a: Self) -> Output;
    fn reduce(a: Output, b: Output) -> Output;
}
Expand description

Number that can be summed over.

Required Methods§

Source

fn zero() -> Output

Zero.

Source

fn map(a: Self) -> Output

Maps the number to owned value.

Source

fn reduce(a: Output, b: Output) -> Output

Returns sum of a and b.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a, X> Sum<X> for &'a X
where X: Add<Output = X> + Copy + Default, &'a X: Add<Output = X>,

Source§

fn zero() -> X

Source§

fn map(a: &'a X) -> X

Source§

fn reduce(a: X, b: X) -> X

Implementors§

Source§

impl<X> Sum<X> for X
where X: Default + Add<Output = X>,