traits
Common traits for generic functionality
1024" x-on:close-sidebar="sidebar=window.innerWidth > 1024 && true">
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Equality definition.
It must satisfy all of the following conditions:
- Symmetry: if module
A
implementsPartialEq
and moduleB
implementsPartialEq
, andA.PartialEq.t
is equal toB.PartialEq.rhs
andB.PartialEq.t
is equal toA.PartialEq.rhs
, theneq (module A) a b
implieseq (module B) b a
- Transitivity: if modules
A
,A'
,B
andC
all implementPartialEq
, andA.PartialEq.rhs
is equal toB.PartialEq.t
, andB.PartialEq.rhs
is equal toC.PartialEq.t
, andA'.Partial.rhs
is equal toc.PartialEq.t
, theneq (module A) a b
andeq (module B) b c
implieseq (module A') a c
Inequality definition. Must ensure that it is consistent with eq
: ne x y
if true if and only if not (eq x y)
In most cases, Traits.PartialEq.Make
should be used to derive this function automatically. However, there may be cases where it may be more desirable (efficient, clear) to implement it manually.