Trait MagmaApprox

Source
pub trait MagmaApprox<O: Op>:
    Sized
    + PartialEq
    + ApproxEq
    + Clone {
    // Required method
    fn approx(self, _: Self) -> Self;

    // Provided method
    fn ap(self, _: O, lhs: Self) -> Self { ... }
}
Expand description

Types that are approximately closed under a given operator.

a, b ∈ Self ⇒ ∃ c ≈ a ∘ b such that c ∈ Self

Required Methods§

Source

fn approx(self, _: Self) -> Self

Performs an operation.

Provided Methods§

Source

fn ap(self, _: O, lhs: Self) -> Self

Performs specific operation.

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.

Implementors§

Source§

impl<T> MagmaApprox<Additive> for T
where T: Add<T, Output = T> + PartialEq + ApproxEq + Clone,

Source§

impl<T> MagmaApprox<Multiplicative> for T
where T: Mul<T, Output = T> + PartialEq + ApproxEq + Clone,