#macro #structures #remember #ancestor #root

yanked pathify

Build nested structures that remember their ancestors

1 unstable release

new 0.1.0 Dec 13, 2024

#742 in Rust patterns

Download history 113/week @ 2024-12-09

113 downloads per month

MIT license

7KB
134 lines

Description

Easy way to build nested structures. Such structures can be used as keys or database paths.

Usage

pathify! {
    Root {
        Node1
        Node2 {
            Node21
        }
    }
}

fn main() {
    let root = Root::default();
    assert_eq!(root.node2.node21.to_string(), "root.node_2.node_21");
}

Dependencies

~0.6–1.1MB
~21K SLoC