#iterator #struct #conversion #convenience #auto-implementation

macro structinator

Library for transfering data from iterators to structs

1 unstable release

0.1.2 Jun 17, 2024
0.1.1 Aug 4, 2023

#35 in #convenience


Used in structinator_traits

Apache-2.0

12KB
51 lines

structinator is a library for easy implementation of SpecifyCreatableStruct from structinator_traits. Just add the attribute #[iter_convertable] to the struct you want to implement SpecifyCreatableStruct, and an automatic implementation of the trait will allow conversion between iterators and the structure of your choice! For more information, check this library's documentation below.


lib.rs:

The Struct-inator 3000!

A procedural macro library for allowing conversion from iterators to user-defined structs.

This library does so by implementing a procedural macro, [macro@iter_convertable] for struct definitions that automatically implements structinator_traits::SpecifyCreatableStruct for the defined struct.

For more information about how [macro@iter_convertable] implements SpecifyCreatableStruct, visit the macro's documentation

For more information about how an implementation of SpecifyCreatableStruct allows for easy conversion between Iterators and structs, visit the documentation of structinator_traits

Dependencies

~250–700KB
~17K SLoC