curmacro 1.0.0

Crate with usefull macros like struct getters and setters creation macros
Documentation
  • Coverage
  • 66.67%
    2 out of 3 items documented2 out of 2 items with examples
  • Size
  • Source code size: 14.76 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.05 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • vxoid/curmacro
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CURVoid

Curmacro

Crate with usefull macros like struct getters and setters creation macros

Links

Example

use curmacro::*;

struct Point {
    pub x: i32,
    pub y: i32
}

impl Point {
    getters!(
        pub get_x(x) -> i32;
        pub get_y(y) -> i32;    
    );
    setters!(
        pub set_x(i32) -> x;
        pub set_y(i32) -> y;    
    );
}

let x = 13;
let y = 215;
let mut point = Point { x, y };

assert_eq!(point.get_x().clone(), x);
assert_eq!(point.get_y().clone(), y);
let x = 993;
let y = 37;

point.set_x(x);
point.set_y(y);

assert_eq!(point.get_x().clone(), x);
assert_eq!(point.get_y().clone(), y);