Skip to content

Commit 0c08281

Browse files
daxpeddaModProg
authored andcommitted
Add documentation
1 parent 52b4f44 commit 0c08281

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Fixed
11+
- Use stable methods to retrieve the discriminant in `PartialOrd` and `Ord`
12+
implementations. Safe methods are now also used with the `safe` crate
13+
feature, significantly improving the performance there.
14+
815
## [1.2.3] - 2023-08-23
916

1017
### Fixed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,12 @@ Unions only support [`Clone`] and [`Copy`].
285285
default too. Without this feature [`transmute`] is
286286
used to convert [`Discriminant`] to a [`i32`],
287287
which is the underlying type.
288-
- `safe`: Implements [`Ord`] and [`PartialOrd`] manually. This is much
289-
slower, but might be preferred if you don't trust derive-where. It also
290-
replaces all cases of [`core::hint::unreachable_unchecked`] in [`Ord`],
291-
[`PartialEq`] and [`PartialOrd`], which is what std uses, with
292-
[`unreachable`].
288+
- `safe`: Implements [`Ord`] and [`PartialOrd`] on enums with a non-default
289+
representation and at least one non-empty variant without unsafely
290+
accessing the discriminant. This is much slower, but might be preferred if
291+
you don't trust derive-where. It also replaces all cases of
292+
[`core::hint::unreachable_unchecked`] in [`Ord`], [`PartialEq`] and
293+
[`PartialOrd`], which is what std uses, with [`unreachable`].
293294
- `zeroize`: Allows deriving [`Zeroize`] and [`zeroize`][method@zeroize] on
294295
[`Drop`].
295296
- `zeroize-on-drop`: Allows deriving [`Zeroize`] and [`ZeroizeOnDrop`] and

src/lib.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,12 @@
324324
//! default too. Without this feature [`transmute`](core::mem::transmute) is
325325
//! used to convert [`Discriminant`](core::mem::Discriminant) to a [`i32`],
326326
//! which is the underlying type.
327-
//! - `safe`: Implements [`Ord`] and [`PartialOrd`] manually. This is much
328-
//! slower, but might be preferred if you don't trust derive-where. It also
329-
//! replaces all cases of [`core::hint::unreachable_unchecked`] in [`Ord`],
330-
//! [`PartialEq`] and [`PartialOrd`], which is what std uses, with
331-
//! [`unreachable`].
327+
//! - `safe`: Implements [`Ord`] and [`PartialOrd`] on enums with a non-default
328+
//! representation and at least one non-empty variant without unsafely
329+
//! accessing the discriminant. This is much slower, but might be preferred if
330+
//! you don't trust derive-where. It also replaces all cases of
331+
//! [`core::hint::unreachable_unchecked`] in [`Ord`], [`PartialEq`] and
332+
//! [`PartialOrd`], which is what std uses, with [`unreachable`].
332333
//! - `zeroize`: Allows deriving [`Zeroize`] and [`zeroize`][method@zeroize] on
333334
//! [`Drop`].
334335
//! - `zeroize-on-drop`: Allows deriving [`Zeroize`] and [`ZeroizeOnDrop`] and

0 commit comments

Comments
 (0)