compile_ops 0.1.3

Compile time operations to not affect your performance and constness with ecuations you can encode.
Documentation
  • Coverage
  • 100%
    9 out of 9 items documented2 out of 9 items with examples
  • Size
  • Source code size: 17.47 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 316.89 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • NonNullableName

compile_ops

This Rust library provides macros that expand to the result of operations like addition,substraction,division,multiplication or power and a macro for join them all.

All the macros support exclusion of expressions thought '!' before they,useful when you cannot prevent code to expand inside the tokens passed;nowadays only possible thought the MBE expansion bucles.

This crate is no_std.

Examples

#![feature(proc_macro_hygiene)]

use compile_ops::*;

assert_eq!(2, add!(1!5, !5, 1)); // five it is not invited...
assert_eq!(2, sub!(3, 1));
assert_eq!(2, mul!(2, 1));
assert_eq!(2, div!(4, 2));
assert_eq!(2, rem!(11, 3));

assert_eq!(2, ops!(2 % 2 + 2 * 2 ^ 1 / 1 - 2));