SHARE
TWEET

Untitled

a guest Oct 19th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. trait C {}
  2.  
  3. impl C for A {}
  4.  
  5. impl C for B {}
  6.  
  7. pub struct A {}
  8.  
  9. pub struct B {}
  10.  
  11. fn main() {
  12.     println!("Hello, world!");
  13.     let x = "a";
  14.     let s: Box<dyn C> = match x {
  15.         "a" => Box::new(A {}),
  16.         "b" => Box::new(B {}),
  17.         _ => panic!()
  18.     };
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top