Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abonander/enum_ns
A Rust compiler plugin that gives enum variants within a module the old namespacing behavior.
https://github.com/abonander/enum_ns
Last synced: about 2 months ago
JSON representation
A Rust compiler plugin that gives enum variants within a module the old namespacing behavior.
- Host: GitHub
- URL: https://github.com/abonander/enum_ns
- Owner: abonander
- License: mit
- Created: 2014-11-25T04:11:25.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-25T04:26:19.000Z (about 10 years ago)
- Last Synced: 2024-10-14T09:15:46.141Z (3 months ago)
- Language: Rust
- Size: 211 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
enum_ns
==========A Rust compiler plugin that gives enum variants within a module the old namespacing behavior.
Supplies the `#[promote_variants]` attribute that, when applied to a crate or module, will add `use Enum::{Variant1, Variant2, ..};` to the module for each `enum` definition it contains. For forward-compatibility, does not use globs.
Apply the `#[promote_variants(export)]` for the equivalent `pub use` of the above.
Usage
--------Add to Cargo.toml:
```
[dependencies.enum_ns]
git = "https://github.com/cybergeek94/enum_ns"
```Crate example:
```rust
#![feature(phase)]
#![promote_variants]#[phase(plugin)] extern crate enum_ns;
enum MyEnum {
Variant1,
Variant2,
Variant3,
}fn main() {
println!("{}, {}, {}", Variant1, Variant2, Variant3);
}