ui_access

source of std::equal

1// Equality: the Equal interface.2//3// Equal is a lang item (LANGUAGE_SPEC.md section 6.1a) at the canonical4// path std::equal::Equal. A type declaring it takes `==` and `!=` from5// its `equals` (section 4.10), and so does every comparison reaching one6// of its values as a part, so a container compares what it holds rather7// than how much room it has. The compiler satisfies Equal for every8// primitive type through the extensions below, so a `T: Equal` takes9// numbers and `bool` too; `==` on a primitive stays the built-in one.10// Every enum and struct `==` compares, each part comparing, satisfies it11// with no marker too, its `equals` being `compare_parts` below.1213exp interface Equal {14    fn equals(self: &, other: &Self) -> bool;15}1617exp fn equals(self value: &u8, other: &u8) -> bool => value == other;18exp fn equals(self value: &u16, other: &u16) -> bool => value == other;19exp fn equals(self value: &u32, other: &u32) -> bool => value == other;20exp fn equals(self value: &u64, other: &u64) -> bool => value == other;21exp fn equals(self value: &i8, other: &i8) -> bool => value == other;22exp fn equals(self value: &i16, other: &i16) -> bool => value == other;23exp fn equals(self value: &i32, other: &i32) -> bool => value == other;24exp fn equals(self value: &i64, other: &i64) -> bool => value == other;25exp fn equals(self value: &f32, other: &f32) -> bool => value == other;26exp fn equals(self value: &f64, other: &f64) -> bool => value == other;27exp fn equals(self value: &bool, other: &bool) -> bool => value == other;2829// The `equals` of an enum or struct satisfying Equal with no marker, which30// the compiler calls: `==`, structural on such a type.31fn compare_parts<T: Equal>(value: &T, other: &T) -> bool => value == other;