Crates.io | anym |
lib.rs | anym |
version | 0.0.0 |
source | src |
created_at | 2022-12-03 11:53:18.243509 |
updated_at | 2022-12-03 11:53:18.243509 |
description | To emulate anonymous `struct` in Rust. |
homepage | |
repository | |
max_upload_size | |
id | 729051 |
size | 15,634 |
To emulate anonymous struct
in Rust.
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);
}
Pretty useless overall. 🤣