Skip to content

Instantly share code, notes, and snippets.

@freedomtowin
Created June 28, 2025 21:17
Show Gist options
  • Save freedomtowin/14507de79321e301be1f8009cddd4736 to your computer and use it in GitHub Desktop.
Save freedomtowin/14507de79321e301be1f8009cddd4736 to your computer and use it in GitHub Desktop.
Example of creating a Gist using Python
use my_proc_macros_lib::comp;
pub fn test_list_compreh() {
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 if x > 1 && x < 6].collect::<Vec<_>>();
println!("{:?}", result);
assert_eq!(result, [2, 3, 4, 5]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment