Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- macro_rules! tuple_map {
- ($f:expr, $($e:expr),*) => {($($f($e)),*)}
- }
- fn main() {
- let mut words = "I want to make f and g into chars".split_whitespace();
- if let (Some(first), Some(second)) = (words.nth(4), words.nth(1)) {
- let (f,s) = tuple_map!( |c:&str| c.parse::<char>().unwrap(), first, second);
- dbg!((f, s));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement