daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest May 16th, 2018 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use std::fmt::Debug;
  2.  
  3. fn main() {
  4.     println!("whee: {:?}, {:?}", whee(5u32), whee(6u64));
  5.     println!(
  6.         "mwahaha: {:?}, {:?}",
  7.         mwahaha(true, 5u32, 6u64),
  8.         mwahaha(false, 7u64, 8u32)
  9.     );
  10. }
  11.  
  12. // I was slightly surprised you can do this:
  13. fn whee(x: impl Debug) -> impl Debug {
  14.     x
  15. }
  16.  
  17. // But this you can't:
  18. fn mwahaha(p: bool, x: impl Debug, y: impl Debug) -> impl Debug {
  19.     if p {
  20.         x
  21.     } else {
  22.         y
  23.     }
  24. }
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