pub trait TryOp: Sized {
    // Required methods
    fn try_op<F: FnOnce(f32, f32) -> f32>(
        &self,
        rhs: &Self,
        op: F
    ) -> Option<Self>;
    fn try_op_to<T, F: FnOnce(f32, f32) -> T>(
        &self,
        rhs: &Self,
        op: F
    ) -> Option<T>;
}
Expand description

A trait for values that potentially support a binary operation (e.g. if they have the same unit).

Required Methods§

source

fn try_op<F: FnOnce(f32, f32) -> f32>(&self, rhs: &Self, op: F) -> Option<Self>

Returns the result of the operation in the same type, if possible.

source

fn try_op_to<T, F: FnOnce(f32, f32) -> T>(&self, rhs: &Self, op: F) -> Option<T>

Returns the result of the operation in a different type, if possible.

Implementors§