AssertCloseTo

Trait AssertCloseTo 

Source
pub trait AssertCloseTo<T> {
    // Required methods
    fn assert_close_to(&self, other: T, precision: i32);
    fn assert_far_from(&self, other: T, precision: i32);
}
Expand description

A trace that guarantees that two decimals are equal to a specified precision. Implemented in float type by default.

2つの小数が指定した精度で等しいことを保証するトレイト。 デフォルトでfloat型に実装されている。

§Examples

use close_to::{assert_far_from, AssertCloseTo};

1.0.assert_close_to(1.0001, 3);
1.0.assert_far_from(1.0001, 4);

Required Methods§

Source

fn assert_close_to(&self, other: T, precision: i32)

Ensures that two decimals are equal with the specified precision.

2つの小数が指定した精度で等しいことを保証する。

Source

fn assert_far_from(&self, other: T, precision: i32)

Ensures that no two decimals are equal at the specified precision.

2つの小数が指定した精度で等しくないことを保証する。

Implementors§

Source§

impl<T: Float + Display, U: Into<T> + Display + Copy> AssertCloseTo<U> for T