Skip to content

Commit 87e9d15

Browse files
committed
Document removal of explicit discriminator requirement
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent 1c60699 commit 87e9d15

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ alternative to the built-in `#[derive(FromPrimitive)]`, which
88
requires the unstable `std::num::FromPrimitive` and is disabled in
99
Rust 1.0.
1010

11-
The current implementation requires all variants of the enum to
12-
have an explicit discriminator value. This restriction may be
13-
relaxed in future versions.
14-
1511
## Documentation
1612

1713
https://andersk.github.io/enum_primitive-rs/enum_primitive/
@@ -40,12 +36,14 @@ enum_from_primitive! {
4036
enum FooBar {
4137
Foo = 17,
4238
Bar = 42,
39+
Baz,
4340
}
4441
}
4542

4643
fn main() {
4744
assert_eq!(FooBar::from_i32(17), Some(FooBar::Foo));
4845
assert_eq!(FooBar::from_i32(42), Some(FooBar::Bar));
46+
assert_eq!(FooBar::from_i32(43), Some(FooBar::Baz));
4947
assert_eq!(FooBar::from_i32(91), None);
5048
}
5149
```

src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828
//! requires the unstable `std::num::FromPrimitive` and is disabled in
2929
//! Rust 1.0.
3030
//!
31-
//! The current implementation requires all variants of the enum to
32-
//! have an explicit discriminator value. This restriction may be
33-
//! relaxed in future versions.
34-
//!
3531
//! # Example
3632
//!
3733
//! ```

0 commit comments

Comments
 (0)