Skip to content

yuifm/nesting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Nesting structs, enums, and impls, in Rust!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages