stackblur_iter/
traits.rs

1//! The home of [`StackBlurrable`].
2
3use std::ops::{Add, AddAssign, Div, Mul, SubAssign};
4
5/// The trait for types which can be blurred by [`StackBlur`][crate::StackBlur].
6///
7/// This trait is auto-implemented for all types that satisfy its requirements.
8///
9/// Types that wish to implement this trait should be signed or use explicitly
10/// wrapping arithmetic.
11///
12/// They should have a significantly higher precision than the pixel format that
13/// they represent, as they may be multiplied by hundreds or thousands before
14/// being divided. They should also ideally be `Copy` so that cloning is cheap.
15pub trait StackBlurrable: Default + Clone + Add<Output = Self> + AddAssign + SubAssign + Mul<usize, Output = Self> + Div<usize, Output = Self> {}
16
17impl<T: Default + Clone + Add<Output = T> + AddAssign + SubAssign + Mul<usize, Output = T> + Div<usize, Output = T>> StackBlurrable for T {}