Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero = 0,
#[num_enum(alternatives = [3,1,4])]
One = 1,
Two = 2,
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: '1' in the alternative values is already attributed as the discriminant of this variant
--> tests/try_build/compile_fail/alternative_clashes_with_its_discriminant.rs:5:34
|
5 | #[num_enum(alternatives = [3,1,4])]
| ^

View File

@@ -0,0 +1,12 @@
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero = 0,
#[num_enum(alternatives = [2])]
One = 1,
Two = 2,
}
fn main() {
}

View File

@@ -0,0 +1,5 @@
error: The discriminant '2' collides with a value attributed to a previous variant
--> tests/try_build/compile_fail/alternative_clashes_with_variant.rs:7:5
|
7 | Two = 2,
| ^^^

View File

@@ -0,0 +1,10 @@
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero = 0,
#[num_enum(alternatives = [5,7,0,3])]
One = 1,
Two = 2,
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: '0' in the alternative values is already attributed to a previous variant
--> tests/try_build/compile_fail/alternative_clashes_with_variant_out_of_order.rs:5:36
|
5 | #[num_enum(alternatives = [5,7,0,3])]
| ^

View File

@@ -0,0 +1,13 @@
const THREE: u8 = 3;
#[derive(num_enum::TryFromPrimitive)]
#[repr(i8)]
enum Numbers {
Zero = 0,
#[num_enum(alternatives = [-1, 2, THREE])]
One = 1,
}
fn main() {
}

View File

@@ -0,0 +1,5 @@
error: Only literals are allowed as num_enum alternate values
--> tests/try_build/compile_fail/alternative_exprs.rs:7:39
|
7 | #[num_enum(alternatives = [-1, 2, THREE])]
| ^^^^^

View File

@@ -0,0 +1,9 @@
#[derive(Debug, Eq, PartialEq, num_enum::FromPrimitive)]
#[repr(u8)]
enum Enum {
Zero = 0,
#[num_enum(catch_all)]
NonZero(u8, u8),
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: Variant with `catch_all` must be a tuple with exactly 1 field matching the repr type
--> tests/try_build/compile_fail/catch_all_multiple_fields.rs:5:16
|
5 | #[num_enum(catch_all)]
| ^^^^^^^^^

View File

@@ -0,0 +1,9 @@
#[derive(Debug, Eq, PartialEq, num_enum::FromPrimitive)]
#[repr(u8)]
enum Enum {
Zero = 0,
#[num_enum(catch_all)]
NonZero = 1,
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: Variant with `catch_all` must be a tuple with exactly 1 field matching the repr type
--> tests/try_build/compile_fail/catch_all_non_tuple.rs:5:16
|
5 | #[num_enum(catch_all)]
| ^^^^^^^^^

View File

@@ -0,0 +1,9 @@
#[derive(Debug, Eq, PartialEq, num_enum::FromPrimitive)]
#[repr(u8)]
enum Enum {
Zero = 0,
#[num_enum(catch_all)]
NonZero(i32),
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: Variant with `catch_all` must be a tuple with exactly 1 field matching the repr type
--> tests/try_build/compile_fail/catch_all_type_mismatch.rs:5:16
|
5 | #[num_enum(catch_all)]
| ^^^^^^^^^

View File

@@ -0,0 +1,9 @@
#[derive(Default, num_enum::Default)]
#[repr(u8)]
enum Number {
#[default]
Zero,
}
fn main() {
}

View File

@@ -0,0 +1,9 @@
error[E0119]: conflicting implementations of trait `Default` for type `Number`
--> tests/try_build/compile_fail/conflicting_default.rs:1:19
|
1 | #[derive(Default, num_enum::Default)]
| ------- ^^^^^^^^^^^^^^^^^ conflicting implementation for `Number`
| |
| first implementation here
|
= note: this error originates in the derive macro `num_enum::Default` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,11 @@
#[derive(num_enum::FromPrimitive, num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero,
#[num_enum(default)]
One,
}
fn main() {
}

View File

@@ -0,0 +1,20 @@
error[E0119]: conflicting implementations of trait `CannotDeriveBothFromPrimitiveAndTryFromPrimitive` for type `Numbers`
--> tests/try_build/compile_fail/conflicting_derive.rs:1:35
|
1 | #[derive(num_enum::FromPrimitive, num_enum::TryFromPrimitive)]
| ----------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Numbers`
| |
| first implementation here
|
= note: this error originates in the derive macro `num_enum::TryFromPrimitive` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0119]: conflicting implementations of trait `TryFrom<u8>` for type `Numbers`
--> tests/try_build/compile_fail/conflicting_derive.rs:1:35
|
1 | #[derive(num_enum::FromPrimitive, num_enum::TryFromPrimitive)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: conflicting implementation in crate `core`:
- impl<T, U> TryFrom<U> for T
where U: Into<T>;
= note: this error originates in the derive macro `num_enum::TryFromPrimitive` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,56 @@
#[derive(num_enum::TryFromPrimitive)]
#[num_enum(error_type(name = CustomError))]
#[repr(u8)]
enum MissingConstructor {
Zero,
One,
Two,
}
#[derive(num_enum::TryFromPrimitive)]
#[num_enum(error_type(constructor = CustomError::new))]
#[repr(u8)]
enum MissingName {
Zero,
One,
Two,
}
#[derive(num_enum::TryFromPrimitive)]
#[num_enum(error_type(name = CustomError, constructor = CustomError::new, extra = something))]
#[repr(u8)]
enum ExtraAttr {
Zero,
One,
Two,
}
#[derive(num_enum::TryFromPrimitive)]
#[num_enum(error_type(name = CustomError, constructor = CustomError::new), error_type(name = CustomError, constructor = CustomError::new))]
#[repr(u8)]
enum TwoErrorTypes {
Zero,
One,
Two,
}
#[derive(num_enum::TryFromPrimitive)]
#[num_enum(error_type(name = CustomError, constructor = CustomError::new))]
#[num_enum(error_type(name = CustomError, constructor = CustomError::new))]
#[repr(u8)]
enum TwoAttrs {
Zero,
One,
Two,
}
struct CustomError {}
impl CustomError {
fn new(_: u8) -> CustomError {
CustomError{}
}
}
fn main() {
}

View File

@@ -0,0 +1,29 @@
error: num_enum error_type attribute requires `constructor` value
--> tests/try_build/compile_fail/custom_error_type_parsing.rs:2:12
|
2 | #[num_enum(error_type(name = CustomError))]
| ^^^^^^^^^^
error: num_enum error_type attribute requires `name` value
--> tests/try_build/compile_fail/custom_error_type_parsing.rs:11:12
|
11 | #[num_enum(error_type(constructor = CustomError::new))]
| ^^^^^^^^^^
error: expected `name` or `constructor`
--> tests/try_build/compile_fail/custom_error_type_parsing.rs:20:75
|
20 | #[num_enum(error_type(name = CustomError, constructor = CustomError::new, extra = something))]
| ^^^^^
error: num_enum attribute must have at most one error_type
--> tests/try_build/compile_fail/custom_error_type_parsing.rs:29:76
|
29 | #[num_enum(error_type(name = CustomError, constructor = CustomError::new), error_type(name = CustomError, constructor = CustomError::new))]
| ^^^^^^^^^^
error: At most one num_enum error_type attribute may be specified
--> tests/try_build/compile_fail/custom_error_type_parsing.rs:39:1
|
39 | #[num_enum(error_type(name = CustomError, constructor = CustomError::new))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@@ -0,0 +1,10 @@
#[derive(Debug, Eq, PartialEq, num_enum::FromPrimitive)]
#[repr(u8)]
enum Enum {
#[default]
Zero = 0,
#[num_enum(catch_all)]
NonZero(u8),
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: Attribute `catch_all` is mutually exclusive with `default`
--> tests/try_build/compile_fail/default_and_catch_all.rs:6:16
|
6 | #[num_enum(catch_all)]
| ^^^^^^^^^

View File

@@ -0,0 +1,10 @@
#[derive(Debug, Eq, PartialEq, num_enum::FromPrimitive)]
#[repr(u8)]
enum Enum {
#[num_enum(default)]
Zero = 0,
#[num_enum(catch_all)]
NonZero(u8),
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: Attribute `catch_all` is mutually exclusive with `default`
--> tests/try_build/compile_fail/default_and_catch_all_alt.rs:6:16
|
6 | #[num_enum(catch_all)]
| ^^^^^^^^^

View File

@@ -0,0 +1,10 @@
#[derive(Debug, Eq, PartialEq, num_enum::FromPrimitive)]
#[repr(u8)]
enum Enum {
Zero = 0,
#[num_enum(catch_all)]
#[default]
NonZero(u8),
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: Attribute `default` is mutually exclusive with `catch_all`
--> tests/try_build/compile_fail/default_and_catch_all_same_variant.rs:6:5
|
6 | #[default]
| ^^^^^^^^^^

View File

@@ -0,0 +1,10 @@
#[derive(Debug, Eq, PartialEq, num_enum::FromPrimitive)]
#[repr(u8)]
enum Enum {
Zero = 0,
#[num_enum(catch_all)]
#[num_enum(default)]
NonZero(u8),
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: Attribute `default` is mutually exclusive with `catch_all`
--> tests/try_build/compile_fail/default_and_catch_all_same_variant_alt.rs:6:16
|
6 | #[num_enum(default)]
| ^^^^^^^

View File

@@ -0,0 +1,11 @@
#[derive(num_enum::FromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero = 0,
#[num_enum(alternatives = [2..=255])]
NonZero = 1,
}
fn main() {
}

View File

@@ -0,0 +1,5 @@
error: Ranges are only supported as num_enum alternate values if the `complex-expressions` feature of the crate `num_enum` is enabled
--> tests/try_build/compile_fail/features/!complex-expressions/alternate_exprs_with_range.rs:5:5
|
5 | #[num_enum(alternatives = [2..=255])]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@@ -0,0 +1,11 @@
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero = 0,
#[num_enum(alternatives = [..255])]
NonZero = 1,
}
fn main() {
}

View File

@@ -0,0 +1,5 @@
error: When ranges are used for alternate values, both bounds most be explicitly specified numeric literals
--> tests/try_build/compile_fail/features/complex-expressions/alternate_exprs_range_missing_lower_bound.rs:5:32
|
5 | #[num_enum(alternatives = [..255])]
| ^^^^^

View File

@@ -0,0 +1,11 @@
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero = 0,
#[num_enum(alternatives = [2..])]
NonZero = 1,
}
fn main() {
}

View File

@@ -0,0 +1,5 @@
error: When ranges are used for alternate values, both bounds most be explicitly specified numeric literals
--> tests/try_build/compile_fail/features/complex-expressions/alternate_exprs_range_missing_upper_bound.rs:5:32
|
5 | #[num_enum(alternatives = [2..])]
| ^^^

View File

@@ -0,0 +1,13 @@
const TWO: u8 = 2;
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero = 0,
#[num_enum(alternatives = [TWO..=255])]
NonZero = 1,
}
fn main() {
}

View File

@@ -0,0 +1,5 @@
error: When ranges are used for alternate values, both bounds most be explicitly specified numeric literals
--> tests/try_build/compile_fail/features/complex-expressions/alternate_exprs_range_nonlit_lower_bound.rs:7:32
|
7 | #[num_enum(alternatives = [TWO..=255])]
| ^^^^^^^^^

View File

@@ -0,0 +1,13 @@
const TWOFIVEFIVE: u8 = 255;
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero = 0,
#[num_enum(alternatives = [2..=TWOFIVEFIVE])]
NonZero = 1,
}
fn main() {
}

View File

@@ -0,0 +1,5 @@
error: When ranges are used for alternate values, both bounds most be explicitly specified numeric literals
--> tests/try_build/compile_fail/features/complex-expressions/alternate_exprs_range_nonlit_upper_bound.rs:7:32
|
7 | #[num_enum(alternatives = [2..=TWOFIVEFIVE])]
| ^^^^^^^^^^^^^^^

View File

@@ -0,0 +1,11 @@
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero = 0,
#[num_enum(alternatives = [255..=2])]
NonZero = 1,
}
fn main() {
}

View File

@@ -0,0 +1,5 @@
error: When using ranges for alternate values, upper bound must not be less than lower bound
--> tests/try_build/compile_fail/features/complex-expressions/alternate_exprs_range_swapped_bounds.rs:5:32
|
5 | #[num_enum(alternatives = [255..=2])]
| ^^^^^^^

View File

@@ -0,0 +1,17 @@
#![deny(deprecated)]
use num_enum::UnsafeFromPrimitive;
#[derive(Debug, Eq, PartialEq, UnsafeFromPrimitive)]
#[repr(u8)]
enum Enum {
Zero,
One,
}
fn main() {
unsafe {
assert_eq!(Enum::from_unchecked(0_u8), Enum::Zero);
assert_eq!(Enum::from_unchecked(1_u8), Enum::One);
}
}

View File

@@ -0,0 +1,17 @@
error: use of deprecated associated function `num_enum::UnsafeFromPrimitive::from_unchecked`: Prefer to use `unchecked_transmute_from`, `from_unchecked` will be removed in a future release.
--> tests/try_build/compile_fail/from_unchecked_deprecated_warning.rs:14:26
|
14 | assert_eq!(Enum::from_unchecked(0_u8), Enum::Zero);
| ^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> tests/try_build/compile_fail/from_unchecked_deprecated_warning.rs:1:9
|
1 | #![deny(deprecated)]
| ^^^^^^^^^^
error: use of deprecated associated function `num_enum::UnsafeFromPrimitive::from_unchecked`: Prefer to use `unchecked_transmute_from`, `from_unchecked` will be removed in a future release.
--> tests/try_build/compile_fail/from_unchecked_deprecated_warning.rs:15:26
|
15 | assert_eq!(Enum::from_unchecked(1_u8), Enum::One);
| ^^^^^^^^^^^^^^

View File

@@ -0,0 +1,12 @@
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero = 0,
#[num_enum(garbage)]
One = 1,
Two = 2,
}
fn main() {
}

View File

@@ -0,0 +1,5 @@
error: Invalid attribute: expected one of: `default`, `catch_all`, `alternatives`
--> $DIR/garbage_attribute.rs:5:5
|
5 | #[num_enum(garbage)]
| ^^^^^^^^^^^^^^^^^^^^

View File

@@ -0,0 +1,11 @@
#[derive(num_enum::FromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero,
One,
Two,
}
fn main() {
}

View File

@@ -0,0 +1,7 @@
error: #[derive(num_enum::FromPrimitive)] requires enum to be exhaustive, or a variant marked with `#[default]`, `#[num_enum(default)]`, or `#[num_enum(catch_all)`
--> $DIR/missing_default.rs:1:10
|
1 | #[derive(num_enum::FromPrimitive)]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the derive macro `num_enum::FromPrimitive` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,7 @@
#[derive(num_enum::IntoPrimitive)]
enum Numbers {
Zero,
One,
}
fn main() {}

View File

@@ -0,0 +1,7 @@
error: Missing `#[repr({Integer})]` attribute
--> $DIR/missing_repr.rs:1:10
|
1 | #[derive(num_enum::IntoPrimitive)]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the derive macro `num_enum::IntoPrimitive` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,10 @@
#[derive(Debug, Eq, PartialEq, num_enum::FromPrimitive)]
#[repr(u8)]
enum Enum {
#[num_enum(catch_all)]
Zero(u8),
#[num_enum(catch_all)]
NonZero(u8),
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: Multiple variants marked with `#[num_enum(catch_all)]`
--> tests/try_build/compile_fail/multiple_catch_all.rs:6:16
|
6 | #[num_enum(catch_all)]
| ^^^^^^^^^

View File

@@ -0,0 +1,10 @@
#[derive(Debug, Eq, PartialEq, num_enum::FromPrimitive)]
#[repr(u8)]
enum Enum {
Zero = 0,
#[num_enum(catch_all)]
#[num_enum(catch_all)]
NonZero(u8),
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: Multiple variants marked with `#[num_enum(catch_all)]`
--> tests/try_build/compile_fail/multiple_catch_all_same_variant.rs:6:16
|
6 | #[num_enum(catch_all)]
| ^^^^^^^^^

View File

@@ -0,0 +1,13 @@
#[derive(num_enum::FromPrimitive, num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero,
#[default]
One,
#[default]
Two,
}
fn main() {
}

View File

@@ -0,0 +1,5 @@
error: Multiple variants marked `#[default]` or `#[num_enum(default)]` found
--> $DIR/multiple_defaults.rs:7:5
|
7 | #[default]
| ^^^^^^^^^^

View File

@@ -0,0 +1,13 @@
#[derive(num_enum::FromPrimitive, num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero,
#[default]
One,
#[num_enum(default)]
Two,
}
fn main() {
}

View File

@@ -0,0 +1,5 @@
error: Multiple variants marked `#[default]` or `#[num_enum(default)]` found
--> $DIR/multiple_defaults_different_kinds.rs:7:16
|
7 | #[num_enum(default)]
| ^^^^^^^

View File

@@ -0,0 +1,13 @@
#[derive(num_enum::FromPrimitive, num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero,
#[num_enum(default)]
One,
#[num_enum(default)]
Two,
}
fn main() {
}

View File

@@ -0,0 +1,5 @@
error: Multiple variants marked `#[default]` or `#[num_enum(default)]` found
--> $DIR/multiple_num_enum_defaults.rs:7:16
|
7 | #[num_enum(default)]
| ^^^^^^^

View File

@@ -0,0 +1,8 @@
#[derive(num_enum::IntoPrimitive)]
#[repr(C)]
enum Numbers {
Zero,
One,
}
fn main() {}

View File

@@ -0,0 +1,5 @@
error: repr(C) doesn't have a well defined size
--> $DIR/repr_c.rs:2:8
|
2 | #[repr(C)]
| ^

View File

@@ -0,0 +1,22 @@
use num_enum::{FromPrimitive, IntoPrimitive, TryFromPrimitive};
#[derive(Debug, Eq, PartialEq, TryFromPrimitive)]
#[repr(u8)]
enum Number {
Zero,
NonZero(u8),
}
#[derive(Debug, Eq, PartialEq, FromPrimitive)]
#[repr(u8)]
enum Colour {
Red { intensity: u8 },
}
#[derive(Debug, Eq, PartialEq, IntoPrimitive)]
#[repr(u8)]
enum Meaningless {
Beep(),
}
fn main() {}

View File

@@ -0,0 +1,17 @@
error: `num_enum` only supports unit variants (with no associated data), but `Number::NonZero` was not a unit variant.
--> $DIR/variants_with_fields.rs:7:5
|
7 | NonZero(u8),
| ^^^^^^^^^^^
error: `num_enum` only supports unit variants (with no associated data), but `Colour::Red` was not a unit variant.
--> $DIR/variants_with_fields.rs:13:5
|
13 | Red { intensity: u8 },
| ^^^^^^^^^^^^^^^^^^^^^
error: `num_enum` only supports unit variants (with no associated data), but `Meaningless::Beep` was not a unit variant.
--> $DIR/variants_with_fields.rs:19:5
|
19 | Beep(),
| ^^^^^^

View File

@@ -0,0 +1,66 @@
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Default {
#[num_enum(default)]
Foo = 0,
Bar = 1,
}
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Alternatives {
#[num_enum(alternatives = [])]
Foo = 0,
#[num_enum(alternatives = [3])]
Bar = 1,
#[num_enum(alternatives = [4, 5])]
Baz = 2,
#[num_enum(alternatives = [7])]
#[num_enum(alternatives = [8])]
Blee = 6,
}
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Both {
#[num_enum(default)]
Foo = 0,
#[num_enum(alternatives = [3])]
Bar = 1,
}
mod mixed {
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum AlternativesFollowedByDefaultInSingleAttribute {
#[num_enum(alternatives = [1, 2], default)]
Foo = 0,
}
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum DefaultFollowedByAlternativesInSingleAttribute {
#[num_enum(default, alternatives = [1, 2])]
Foo = 0,
}
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum AlternativesFollowedByDefaultInMultipleAttributes {
#[num_enum(alternatives = [1, 2])]
#[num_enum(default)]
Foo = 0,
}
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum DefaultFollowedByAlternativesInMultipleAttributes {
#[num_enum(default)]
#[num_enum(alternatives = [1, 2])]
Foo = 0,
}
}
fn main() {
}

View File

@@ -0,0 +1,40 @@
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum ExhaustiveTryFrom {
#[num_enum(alternatives = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])]
A = 0,
#[num_enum(alternatives = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])]
B = 16,
#[num_enum(alternatives = [33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47])]
C = 32,
#[num_enum(alternatives = [49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63])]
D = 48,
#[num_enum(alternatives = [65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79])]
E = 64,
#[num_enum(alternatives = [81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95])]
F = 80,
#[num_enum(alternatives = [97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111])]
G = 96,
#[num_enum(alternatives = [113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127])]
H = 112,
#[num_enum(alternatives = [129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143])]
I = 128,
#[num_enum(alternatives = [145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159])]
J = 144,
#[num_enum(alternatives = [161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175])]
K = 160,
#[num_enum(alternatives = [177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191])]
L = 176,
#[num_enum(alternatives = [193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207])]
M = 192,
#[num_enum(alternatives = [209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223])]
N = 208,
#[num_enum(alternatives = [225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239])]
O = 224,
#[num_enum(alternatives = [241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255])]
P = 240,
}
fn main() {
}

View File

@@ -0,0 +1,40 @@
#[derive(num_enum::FromPrimitive)]
#[repr(u8)]
enum ExhaustiveFrom {
#[num_enum(alternatives = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])]
A = 0,
#[num_enum(alternatives = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])]
B = 16,
#[num_enum(alternatives = [33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47])]
C = 32,
#[num_enum(alternatives = [49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63])]
D = 48,
#[num_enum(alternatives = [65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79])]
E = 64,
#[num_enum(alternatives = [81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95])]
F = 80,
#[num_enum(alternatives = [97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111])]
G = 96,
#[num_enum(alternatives = [113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127])]
H = 112,
#[num_enum(alternatives = [129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143])]
I = 128,
#[num_enum(alternatives = [145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159])]
J = 144,
#[num_enum(alternatives = [161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175])]
K = 160,
#[num_enum(alternatives = [177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191])]
L = 176,
#[num_enum(alternatives = [193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207])]
M = 192,
#[num_enum(alternatives = [209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223])]
N = 208,
#[num_enum(alternatives = [225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239])]
O = 224,
#[num_enum(alternatives = [241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255])]
P = 240,
}
fn main() {
}

View File

@@ -0,0 +1,39 @@
#[derive(num_enum::FromPrimitive)]
#[repr(u8)]
enum ExhaustiveFrom {
#[num_enum(default)]
#[num_enum(alternatives = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])]
A = 0,
#[num_enum(alternatives = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31])]
B = 16,
#[num_enum(alternatives = [33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47])]
C = 32,
#[num_enum(alternatives = [49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63])]
D = 48,
#[num_enum(alternatives = [65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79])]
E = 64,
#[num_enum(alternatives = [81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95])]
F = 80,
#[num_enum(alternatives = [97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111])]
G = 96,
#[num_enum(alternatives = [113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127])]
H = 112,
#[num_enum(alternatives = [129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143])]
I = 128,
#[num_enum(alternatives = [145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159])]
J = 144,
#[num_enum(alternatives = [161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175])]
K = 160,
#[num_enum(alternatives = [177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191])]
L = 176,
#[num_enum(alternatives = [193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207])]
M = 192,
#[num_enum(alternatives = [209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223])]
N = 208,
#[num_enum(alternatives = [225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239])]
O = 224,
}
fn main() {
}

View File

@@ -0,0 +1,11 @@
#[derive(num_enum::FromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero = 0,
#[num_enum(alternatives = [2..=255])]
NonZero = 1,
}
fn main() {
}

View File

@@ -0,0 +1,11 @@
#[derive(num_enum::TryFromPrimitive)]
#[repr(u8)]
enum Numbers {
Zero = 0,
#[num_enum(alternatives = [2..255])]
NonZero = 1,
}
fn main() {
}