cmp - [mainnet]
Enum Ordering
enum Ordering has copy, dropVariants
Less
Fields
Equal
Fields
Greater
Fields
Functions
compare
Compares two values with the natural ordering:
- native types are compared identically to
<and other operators - complex types
- Structs and vectors - are compared lexicographically - first field/element is compared first, and if equal we proceed to the next.
- enum’s are compared first by their variant, and if equal - they are compared as structs are.
public fun compare<T>(first: &T, second: &T): cmp::OrderingImplementation
native public fun compare<T>(first: &T, second: &T): Ordering;is_eq
public fun is_eq(self: &cmp::Ordering): boolImplementation
public fun is_eq(self: &Ordering): bool { self is Ordering::Equal}is_ne
public fun is_ne(self: &cmp::Ordering): boolImplementation
public fun is_ne(self: &Ordering): bool { !(self is Ordering::Equal)}is_lt
public fun is_lt(self: &cmp::Ordering): boolImplementation
public fun is_lt(self: &Ordering): bool { self is Ordering::Less}is_le
public fun is_le(self: &cmp::Ordering): boolImplementation
public fun is_le(self: &Ordering): bool { !(self is Ordering::Greater)}is_gt
public fun is_gt(self: &cmp::Ordering): boolImplementation
public fun is_gt(self: &Ordering): bool { self is Ordering::Greater}is_ge
public fun is_ge(self: &cmp::Ordering): boolImplementation
public fun is_ge(self: &Ordering): bool { !(self is Ordering::Less)}Specification
compare
public fun compare<T>(first: &T, second: &T): cmp::Orderingpragma opaque;