Function lrs::cmp::min_ref

Calculates the minimum of two values by reference.

Syntax

fn min_ref<T>(one: &'a T, two: &'a T) -> &'a 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 = &1;
let y = &2;
assert!(min(x, y) == x);

See also