1 unstable release

0.0.0 Dec 3, 2022

#16 in #emulate

MIT license

9KB
216 lines

anym

To emulate anonymous struct in Rust.

Overview

The library provides convenience macro for creating local struct. The struct generated by the macro does not implement any functionality. It is for grouping data.

use anym::anym;
fn main() {
    let v1 = {
        let (x, y) = coor();
        anym!({ tag: tag(), x, y })
    };

    let v2 = {
        let (x, y) = coor();
        anym!({ tag: tag(), x, y })
    };

    println!("{}: ({}, {})", v1.tag, v1.x, v1.y);
    println!("{}: ({}, {})", v2.tag, v2.x, v2.y);
}

Note

Pretty useless overall. 🤣

Dependencies

~2MB
~43K SLoC