Function lrs::cmp::min_mut

Calculates the minimum of two values by mutable reference.

Syntax

fn min_mut<T>(one: &'a mut T, two: &'a mut T) -> &'a mut T
    where T: Ord<T> + ?Sized,

Arguments

NameDescription
one

The first value.

two

The second value.

Return value

The returns the smaller one of the two values.

Remarks

If the comparison of both objects returns that they are equal, the first one is returned.

Examples

let x = &mut 1;
let y = &mut 2;
*min(x, y) = 3;
assert!(*x == 3);

See also