Skip to main content

Term

Trait Term 

Source
pub trait Term: Copy {
    // Required method
    fn term<C>(self) -> C
       where C: Tally;

    // Provided method
    fn terms<C>(items: &[Self]) -> C
       where C: Tally { ... }
}
Expand description

An item that sums into any Tally: a Boolean, as 0 or 1, or an integer.

Required Methods§

Source

fn term<C>(self) -> C
where C: Tally,

self as a term of a sum in C. An integer wider than C keeps its low bits, which leaves exact every sum that fits C.

Provided Methods§

Source

fn terms<C>(items: &[Self]) -> C
where C: Tally,

The sum of items in C.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Term for bool

Source§

fn terms<C>(items: &[bool]) -> C
where C: Tally,

Each chunk of 192 items counts into byte totals, 16 to a vector. In wasm, a running 64-bit total doesn’t vectorise, and 16-bit totals cost about 4 times as much as bytes.

Source§

fn term<C>(self) -> C
where C: Tally,

Source§

impl Term for i16

Source§

fn term<C>(self) -> C
where C: Tally,

Source§

impl Term for i32

Source§

fn term<C>(self) -> C
where C: Tally,

Source§

impl Term for i64

Source§

fn term<C>(self) -> C
where C: Tally,

Source§

impl Term for u8

Source§

fn term<C>(self) -> C
where C: Tally,

Implementors§