nesting

Crates.ionesting
lib.rsnesting
version0.1.1
created_at2025-09-08 19:46:57.728521+00
updated_at2025-09-08 19:52:04.623083+00
descriptionNesting structs, enums, and impls, in Rust!
homepage
repositoryhttps://github.com/yuifm/nesting
max_upload_size
id1829797
size28,792
Yui (yuifm)

documentation

https://docs.rs/nesting

README

Nesting

Nesting is a Rust proc-macro library for defining structs, enums, and impls in a nested fashion.

Ideal for writing configs or heavily-nested data structures.

Installation

$ cargo add nesting

Example

nesting::nest! {
	#![derive(Debug)]

    struct MyStruct {
        child: MyChildStruct

        struct MyChildStruct {
            is_nested: bool,

            impl Default for MyChildStruct {
                fn default() -> Self {
                    Self { is_nested: true}
                }
            }
        }
    }
}

fn main() {
	let x = MyStruct {
		child: MyChildStruct::default(),
	};

	dbg!(&x);
}

Check out the docs for more info or take a look at the nesting-examples directory for a more detailed showcase of everything you can do with this crate.

Commit count: 3

cargo fmt