Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::fmt;
- trait Show: fmt::Display + fmt::Debug {}
- impl<T> Show for T where T: fmt::Display + fmt::Debug {}
- fn debug<T: fmt::Debug>(x: &[T]) {
- }
- fn main() {
- let x: Box<String> = Box::new(String::from("hello, world"));
- let x: Box<usize> = Box::new(42);
- let mut y: Vec<Box<dyn Show>> = Vec::new();
- y.push(x);
- debug(y.as_slice())
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement