Advertisement
Guest User

Coderust

a guest
Feb 18th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.31 KB | None | 0 0
  1. use std::fmt::Debug;
  2.  
  3. #[derive(Debug)]
  4. struct TRef<'a, T: 'a> {
  5.     t_num: &'a T,
  6. }
  7.  
  8. struct NoDebug();
  9.  
  10. fn print_t_ref<'a, T>(t: &'a T)
  11. where
  12.    T: Debug + 'a,
  13. {
  14.     println!("this is a generic num: {:?}", t);
  15. }
  16.  
  17. fn main() {
  18.     let generic_ref = TRef { t_num: &32i32 };
  19.     print_t_ref(&k");
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement