Function lrs::cmp::min

Calculates the minimum of two values.

Syntax

fn min<T>(one: T, two: T) -> T
    where T: Ord<T>,

Arguments

NameDescription
one

The first value.

two

The second value.

Return value

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.

Since this function takes ownership of the objects and drops one of them, it is mostly useful for type that implement Copy.

Examples

assert!(min(1, 2) == 1);

See also