Nodyn 0.2.0: Easy polymorphism using enums with Vec Wrapper Support

โš“ Rust    ๐Ÿ“… 2025-08-04    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 5      

surdeus

Warning

This post was published 32 days ago. The information described in this article may have changed.

nodyn 0.2.0: Easy polymorphism using enums with Vec Wrapper Support

Hello Rustaceans! nodyn 0.2.0 is out, enhancing Rustโ€™s enum wrappers with a new Vec wrapper for polymorphic collections. Hereโ€™s a quick example:

nodyn::nodyn! {
	#[derive(Debug]
	pub enum Item { i32, String }
	vec Inventory;
}                                                                                
let mut inv = inventory![100, "sword".to_string()];
inv.push(50);
assert_eq!(inv.iter_i32().sum::<i32>(), 150); // Counts gold coins

New features of 0.2.0 include generation of polymorphic Vecs with a vec!-like macro & variant methods (e.g., first_i32). In addition optional code generation can now be selected using impl directives for fine-grained control. See Changelog

Try it out: Crates.io | Docs.rs | GitHub

1 post - 1 participant

Read full topic

๐Ÿท๏ธ Rust_feed