Calculates the minimum of two values by reference.
fn min_ref<T>(one: &'a T, two: &'a T) -> &'a T
where T: Ord<T> + ?Sized,| Name | Description |
|---|---|
| one | The first value. |
| two | The second value. |
The returns the smaller one of the two values.
If the comparison of both objects returns that they are equal, the first one is returned.
let x = &1; let y = &2; assert!(min(x, y) == x);