Function lrs::cmp::max

Calculates the maximum of two values.

Syntax

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

Arguments

NameDescription
one

The first value.

two

The second value.

Return value

Returns the larger 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!(max(1, 2) == 2);

See also