Equatable

protocol Equatable<RHS = Self>

Defines semantic equality against RHS.

Conformances should be reflexive for ordinary values and keep equals consistent with derived notEquals. Collections and hashes rely on equal values remaining equal while observed through borrowed references.

Methods

func equals(_ rhs: RHS) -> Bool

Compares Self with RHS according to the conforming type's equality semantics.

View Source
func equals(_ rhs: RHS) -> Bool

func notEquals(_ rhs: RHS) -> Bool

Returns whether the two values are not equal.

View Source
func notEquals(_ rhs: RHS) -> Bool {
	if self.equals(rhs) {
		false
	} else {
		true
	}
}