SHARE
TWEET

Untitled

a guest Aug 25th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pub trait Foo {
  2.     fn foo(_: Self);
  3.     fn bar();
  4.     fn baz(_: u32);
  5. }
  6.  
  7. pub struct Bar;
  8.  
  9. impl Foo for Bar {
  10.     fn foo(_: Self) {
  11.         println!("foo")
  12.     }
  13.    
  14.     fn bar() {
  15.         println!("bar")
  16.     }
  17.    
  18.     fn baz(_: u32) {
  19.         println!("baz")
  20.     }
  21. }
  22.  
  23. impl Bar {
  24.     pub fn qux(_: Self) {
  25.         println!("qux")
  26.     }
  27. }
  28.  
  29. fn main() {
  30.     <_>::foo(Bar);
  31.    
  32.     // None of these compile:
  33.    
  34.     // <_>::bar();
  35.     // <_>::baz(0);
  36.     // <_>::qux(Bar);
  37. }
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