1
1
# safe-discriminant
2
2
3
- ` safe-discriminant ` offers a minimalistic, ` no_std ` compatiable, zero cost
4
- trait + procedural macro for extraction of discriminant out of enums.
3
+ ` safe-discriminant ` provides a minimalistic, ` no_std ` compatible trait and
4
+ procedural macro for extracting discriminants from enums at zero cost. It
5
+ automatically generates ` unsafe { ... } ` blocks, ensuring semantic safety so
6
+ you don’t have to worry about it.
5
7
6
8
## Installation
7
9
8
- This crate is available on crates.io and can be used by adding the following to
9
- your project's Cargo.toml:
10
-
11
- ``` toml
12
- [dependencies ]
13
- safe-discriminant = " 0.1.0"
14
- ```
15
- Or run this command in your cargo project:
16
-
17
- ``` sh
18
- $ cargo add safe-discriminant
19
- ```
10
+ This crate is available on [ crates.io] ( crates.io ) and can be easily included in
11
+ your project by:
12
+ * Adding the following line to your Cargo.toml:
13
+ ``` toml
14
+ [dependencies ]
15
+ safe-discriminant = " 0.1.0"
16
+ ```
17
+ * Or runing this command in your cargo project:
18
+ ``` sh
19
+ $ cargo add safe-discriminant
20
+ ```
20
21
21
22
## Usage
22
23
@@ -43,7 +44,8 @@ fn main() {
43
44
44
45
## Similar Projects
45
46
46
- * [ strum] ( https://crates.io/crates/strum ) offers a collection of macros for
47
- simplifying working with enums. One of those macros is
48
- [ ` EnumDiscriminants ` ] ( https://docs.rs/strum_macros/latest/strum_macros/derive.EnumDiscriminants.html ) .
49
- ` EnumDiscriminants ` extracts the name of each variant of the enum into a separate enum.
47
+ * [ strum] ( https://crates.io/crates/strum ) provides a collection of macros
48
+ designed to simplify working with enums. Among these macros is
49
+ [ ` EnumDiscriminants ` ] ( https://docs.rs/strum_macros/latest/strum_macros/derive.EnumDiscriminants.html ) ,
50
+ which extracts the name of each variant from the enum and organizes them into
51
+ a separate enum.
0 commit comments