Guest User

Untitled

a guest
Jul 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. use std::fmt::Debug;
  2.  
  3. #[derive(Debug)]
  4. struct Opt<T: Debug>(Option<T>);
  5.  
  6. fn main() {
  7. let op: Opt<&str> = Opt(Some("Hello World!"));
  8.  
  9. println!("Op: {:?}", op);
  10. let nick_bad = match op.0 {
  11. Some(ref nick) => nick.starts_with('!'),
  12. None => false,
  13. };
  14. println!("Bad nick ?: {}", nick_bad);
  15. }
Add Comment
Please, Sign In to add comment