Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. use std::fmt;
  2.  
  3. trait Show: fmt::Display + fmt::Debug {}
  4.  
  5. impl<T> Show for T where T: fmt::Display + fmt::Debug {}
  6.  
  7. fn debug<T: fmt::Debug>(x: &[T]) {
  8.  
  9. }
  10.  
  11. fn main() {
  12. let x: Box<String> = Box::new(String::from("hello, world"));
  13. let x: Box<usize> = Box::new(42);
  14. let mut y: Vec<Box<dyn Show>> = Vec::new();
  15. y.push(x);
  16. debug(y.as_slice())
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement