Skip to content

Commit 1d47c0a

Browse files
committed
manual: note overloading and traits for comparison ops.
1 parent eff4a36 commit 1d47c0a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

doc/rust.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,7 +1697,7 @@ The default meaning of the operators on standard types is given here.
16971697

16981698
#### Bitwise operators
16991699

1700-
Bitwise operators apply are, like the [arithmetic operators](#arithmetic-operators),
1700+
Bitwise operators are, like the [arithmetic operators](#arithmetic-operators),
17011701
syntactic sugar for calls to built-in traits.
17021702
This means that bitwise operators can be overridden for user-defined types.
17031703
The default meaning of the operators on standard types is given here.
@@ -1730,21 +1730,31 @@ and `&&` only when it evaluates to `true`.
17301730

17311731
#### Comparison operators
17321732

1733+
Comparison operators are, like the [arithmetic operators](#arithmetic-operators),
1734+
and [bitwise operators](#bitwise-operators),
1735+
syntactic sugar for calls to built-in traits.
1736+
This means that comparison operators can be overridden for user-defined types.
1737+
The default meaning of the operators on standard types is given here.
1738+
17331739
`==`
17341740
: Equal to.
1741+
Calls the `eq` method on the `core::cmp::Eq` trait.
17351742
`!=`
17361743
: Unequal to.
1744+
Calls the `ne` method on the `core::cmp::Eq` trait.
17371745
`<`
17381746
: Less than.
1747+
Calls the `lt` method on the `core::cmp::Ord` trait.
17391748
`>`
17401749
: Greater than.
1750+
Calls the `gt` method on the `core::cmp::Ord` trait.
17411751
`<=`
17421752
: Less than or equal.
1753+
Calls the `le` method on the `core::cmp::Ord` trait.
17431754
`>=`
17441755
: Greater than or equal.
1756+
Calls the `ge` method on the `core::cmp::Ord` trait.
17451757

1746-
The binary comparison operators can be applied to any two operands of
1747-
the same type, and produce a boolean value.
17481758

17491759
#### Type cast expressions
17501760

0 commit comments

Comments
 (0)