Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::fmt::Display;
- trait Show {
- fn show(&self) -> String;
- }
- impl<T: Display> Show for T {
- fn show(&self) -> String {
- format!("{}", &self)
- }
- }
- fn blah_vtable<F>(f: F, x: i32, y: bool, z: char) -> String
- where
- F: Fn(&dyn Show) -> String,
- {
- format!("{} {} {}", f(&x), f(&y), f(&z))
- }
- fn main() {
- println!("Hello, world!");
- }
Add Comment
Please, Sign In to add comment