daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. macro_rules! tuple_map {
  2.     ($f:expr, $($e:expr),*) => {($($f($e)),*)}
  3. }
  4.  
  5. fn main() {
  6.    let mut words = "I want to make f and g into chars".split_whitespace();
  7.    if let (Some(first), Some(second)) = (words.nth(4), words.nth(1)) {
  8.        let (f,s) = tuple_map!( |c:&str| c.parse::<char>().unwrap(), first, second);
  9.        dbg!((f, s));
  10.    }
  11. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top