Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::fmt::Debug;
- fn main() {
- println!("whee: {:?}, {:?}", whee(5u32), whee(6u64));
- println!(
- "mwahaha: {:?}, {:?}",
- mwahaha(true, 5u32, 6u64),
- mwahaha(false, 7u64, 8u32)
- );
- }
- // I was slightly surprised you can do this:
- fn whee(x: impl Debug) -> impl Debug {
- x
- }
- // But this you can't:
- fn mwahaha(p: bool, x: impl Debug, y: impl Debug) -> impl Debug {
- if p {
- x
- } else {
- y
- }
- }
Add Comment
Please, Sign In to add comment