Correct invariant documentation for steps_between

Given that the previous example involves stepping forward from A to B,
the equivalent example on this line would make most sense as stepping
backward from B to A.
This commit is contained in:
David Thompson 2021-07-14 13:48:18 -07:00
parent 4f0c568785
commit e753f30543

View File

@ -30,7 +30,7 @@ pub trait Step: Clone + PartialOrd + Sized {
/// For any `a`, `b`, and `n`: /// For any `a`, `b`, and `n`:
/// ///
/// * `steps_between(&a, &b) == Some(n)` if and only if `Step::forward_checked(&a, n) == Some(b)` /// * `steps_between(&a, &b) == Some(n)` if and only if `Step::forward_checked(&a, n) == Some(b)`
/// * `steps_between(&a, &b) == Some(n)` if and only if `Step::backward_checked(&a, n) == Some(a)` /// * `steps_between(&a, &b) == Some(n)` if and only if `Step::backward_checked(&b, n) == Some(a)`
/// * `steps_between(&a, &b) == Some(n)` only if `a <= b` /// * `steps_between(&a, &b) == Some(n)` only if `a <= b`
/// * Corollary: `steps_between(&a, &b) == Some(0)` if and only if `a == b` /// * Corollary: `steps_between(&a, &b) == Some(0)` if and only if `a == b`
/// * Note that `a <= b` does _not_ imply `steps_between(&a, &b) != None`; /// * Note that `a <= b` does _not_ imply `steps_between(&a, &b) != None`;