or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
PartialOrd
DocumentationStrict partial ordering relation.
This trait extends the partial equivalence relation provided by
PartialEq
(==
) withpartial_cmp(a, b) -> Option<Ordering>
, which is a trichotomy of the ordering relation when its result isSome
:a < b
thenpartial_cmp(a, b) == Some(Less)
a > b
thenpartial_cmp(a, b) == Some(Greater)
a == b
thenpartial_cmp(a, b) == Some(Equal)
and the absence of an ordering between
a
andb
whenpartial_cmp(a, b) == None
. Furthermore, this trait defines<=
asa < b || a == b
and>=
asa > b || a == b
.The comparisons must satisfy, for all
a
,b
, andc
:a < b
andb < c
thena < c
a < b
thenb > a
The
lt
(<
),le
(<=
),gt
(>
), andge
(>=
) methods are implemented in terms ofpartial_cmp
according to these rules. The default implementations can be overridden for performance reasons, but manual implementations must satisfy the rules above.From these rules it follows that
PartialOrd
must be implemented symmetrically and transitively: ifT: PartialOrd<U>
andU: PartialOrd<V>
thenU: PartialOrd<T>
andT: PartialOrd<V>
.The following corollaries follow from transitivity of
<
, duality, and from the definition of<
et al. in terms ofthe same
partial_cmp
:<
:!(a < a)
>
: ifa > b
andb > c
thena > c
<
: ifa < b
then!(b < a)
<
: ifa < b
then!(a > b)
Stronger ordering relations can be expressed by using the
Eq
andOrd
traits, where thePartialOrd
methods provide:T: PartialOrd + Eq
T: Ord