struct@ Ord
XuAPI
struct@ Ord {
fn less(Self) bool
}用途
方法集约束 `Ord`。实现类型须提供下列方法。不是接口值。
参数
lessfn less(Self) bool- `Ord` 上的方法:是否严格小于另一值。
API
#cmp比较:struct@ Ord 与 less_*/compare_*。f64:NaN 小于非 NaN,NaN 等于 NaN。
struct@ Ordstruct@ Ord {
fn less(Self) bool
}方法集约束 `Ord`。实现类型须提供下列方法。不是接口值。
less fn less(Self) bool(Ord) lessfn less(Self) bool`Ord` 上的方法:是否严格小于另一值。
self Selfother Selfbool — 是否成立
less_stringpub fn less_string(a string, b string) bool小于字符串。
a stringb stringbool — 是否成立
less_intpub fn less_int(a int, b int) bool小于int。
a intb intbool — 是否成立
compare_intpub fn compare_int(a int, b int) int比较int。
a intb intint — 小于 -1、相等 0、大于 1
less_f64pub fn less_f64(a f64, b f64) bool小于f64。
a f64b f64bool — 是否成立
compare_f64pub fn compare_f64(a f64, b f64) int比较f64。
a f64b f64int — 小于 -1、相等 0、大于 1
or_intpub fn or_int(a int, b int) intorint。
a intb intint — 该类型的值
or_stringpub fn or_string(a &string, b &string) stringor字符串。
a &stringb &stringstring — 结果字符串
or_f64pub fn or_f64(a f64, b f64) f64orf64。
a f64b f64f64 — 该类型的值
compare_stringpub fn compare_string(a string, b string) int比较字符串。
a stringb stringint — 小于 -1、相等 0、大于 1