This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Python comprehension proc macro that handles multiple nested for-if-clauses, flattening nested structure. | |
| // Example: | |
| // | |
| // let vec_of_vecs = vec![vec![1, 2, 3], vec![4, 5, 6]]; | |
| // | |
| // let result = comp![x for vec in vec_of_vecs for x in vec].collect::<Vec<_>>(); | |
| // assert_eq!(result, [1, 2, 3, 4, 5, 6]); | |
| // | |
| use proc_macro2::TokenStream as TokenStream2; |