Guest User

Untitled

a guest
May 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. fn main() {
  2. #[derive(Debug)]
  3. enum Foo {
  4. Bar,
  5. Boo { a: usize },
  6. }
  7.  
  8. impl Foo {
  9. fn print(&self) {
  10. println!("{:?}", self);
  11. }
  12.  
  13. fn boo(a: usize) -> Self {
  14. Foo::Boo { a }
  15. }
  16.  
  17. fn bar() -> Self {
  18. Foo::Bar
  19. }
  20. }
  21.  
  22. Foo::boo(123).print();
  23. Foo::bar().print();
  24. }
Add Comment
Please, Sign In to add comment