#integer #bounded #plugin #macro #compiler-plugin

nightly bounded-integer-plugin

Bounded integers compiler plugin

2 releases

Uses old Rust 2015

0.1.1 Jun 5, 2016
0.1.0 Apr 17, 2016

#24 in #compiler-plugin

ISC license

12KB
251 lines

Provides the procedural macro bounded_integer! for generating enums for the bounded-integer crate.

Syntax

The syntax parsed by bounded_integer! is roughly equivalent to the following macro_rules!-like matcher.

$(#[$attr:meta])*
$(pub)? enum $name:ident: $repr:ident { $min:expr...$max:expr }

Which expands to the following:

$(#[$attr:meta])*
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
#[repr($repr)]
$(pub)? enum $name { ... }
bounded_integer_impls!($name, $repr, ..., ...);

Where ... are variants of the form ...N1, Z0, P1....

Note that the bounded_integer_impls! macro is provided by the bounded-integer crate.

No runtime deps