Skip to main content

SumDomain

Trait SumDomain 

Source
pub trait SumDomain<K> {
    // Required method
    fn keys(&self) -> impl Iterator<Item = K> + '_;
}
Expand description

Domain over which sum_over iterates. Lets a single sum_over call accept either a Set (with typed key decoding via FromIndexKey) or a borrowed slice of Copy keys, without intermediate conversions.

Returns an iterator (rather than taking a callback) so the trait method monomorphizes through to the loop body in sum_over, allowing inlining in hot sums. Implementations are typically one line.

Required Methods§

Source

fn keys(&self) -> impl Iterator<Item = K> + '_

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<K: Copy, const N: usize> SumDomain<K> for [K; N]

Source§

fn keys(&self) -> impl Iterator<Item = K> + '_

Source§

impl<K: Copy> SumDomain<K> for Vec<K>

Source§

fn keys(&self) -> impl Iterator<Item = K> + '_

Source§

impl<K: Copy> SumDomain<K> for [K]

Source§

fn keys(&self) -> impl Iterator<Item = K> + '_

Implementors§