XU XUv0.16.0

#cmp

import: #cmp

counts: 9 functions, 0 methods, 0 types, 0 constants, 1 method sets

Comparison: struct@ Ord and less_*/compare_*. f64: NaN is less than non-NaN; NaN equals NaN.

struct@ Ord

XuAPI
struct@ Ord {
    fn less(Self) bool
}

Purpose

Method-set constraint Ord.

Required methods

less fn less(Self) bool
Operation on Ord: whether this value is strictly less than the other.

(Ord) less

XuAPI
fn less(Self) bool

Purpose

Operation on Ord: whether this value is strictly less than the other.

Parameters

self Self
The Self instance used by this call (value receiver).
other Self
the other value of the same type (Self)

Returns

bool — true or false

less_string

XuAPI
pub fn less_string(a string, b string) bool

Purpose

Lexicographic string compare (same rules as former sort.str_less). Used when builtin string.less is lowered; also callable directly.

Parameters

a string
left operand (string)
b string
right operand (string)

Returns

bool — true or false

less_int

XuAPI
pub fn less_int(a int, b int) bool

Purpose

Less int.

Parameters

a int
left operand (int)
b int
right operand (int)

Returns

bool — true or false

compare_int

XuAPI
pub fn compare_int(a int, b int) int

Purpose

Compare int.

Parameters

a int
left operand (int)
b int
right operand (int)

Returns

int — negative if less, zero if equal, positive if greater

less_f64

XuAPI
pub fn less_f64(a f64, b f64) bool

Purpose

Less f64.

Parameters

a f64
left operand (f64)
b f64
right operand (f64)

Returns

bool — true or false

compare_f64

XuAPI
pub fn compare_f64(a f64, b f64) int

Purpose

Compare f64.

Parameters

a f64
left operand (f64)
b f64
right operand (f64)

Returns

int — negative if less, zero if equal, positive if greater

or_int

XuAPI
pub fn or_int(a int, b int) int

Purpose

1.22 cmp.Or as two-arg pairs (no generic comparable / variadic).

Parameters

a int
value (int)
b int
b (int)

Returns

int — a value of this type

or_string

XuAPI
pub fn or_string(a &string, b &string) string

Purpose

Or string.

Parameters

a &string
value (read-only borrow; caller keeps the original; type &string)
b &string
b (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

or_f64

XuAPI
pub fn or_f64(a f64, b f64) f64

Purpose

Return the first non-zero f64, or 0.0.

Parameters

a f64
value (f64)
b f64
b (f64)

Returns

f64 — a value of this type

compare_string

XuAPI
pub fn compare_string(a string, b string) int

Purpose

Compare string.

Parameters

a string
left operand (string)
b string
right operand (string)

Returns

int — negative if less, zero if equal, positive if greater