Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement