Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xieyuschen/rs-sumtype-boilerplate
[WIP] Macros for manipulating enums in Rust
https://github.com/xieyuschen/rs-sumtype-boilerplate
Last synced: about 1 month ago
JSON representation
[WIP] Macros for manipulating enums in Rust
- Host: GitHub
- URL: https://github.com/xieyuschen/rs-sumtype-boilerplate
- Owner: xieyuschen
- License: bsd-2-clause
- Created: 2024-08-12T04:26:22.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-08-12T08:41:15.000Z (5 months ago)
- Last Synced: 2024-08-13T10:15:41.443Z (5 months ago)
- Language: Rust
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# rs-sumtype-boilplate
Library `rs-sumtype-boilplate` provides some useful macros to manipulate sum-type(enum) inside your project.
## Supported Macros
### Macro `create_sumtype`
Macro `create_sumtype` generates an enum type according to the types you passed.
For example, the following macro usage will produce an enum `MySum`.```rust
struct A;
struct B;
create_sumtype!(MySum, A, B);
```The `MySum` is equivalent to the definition below:
```rust
enum MySum {
MySumA(A),
MySumB(B),
}
```