Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- #[derive(Debug)]
- enum Foo {
- Bar,
- Boo { a: usize },
- }
- impl Foo {
- fn print(&self) {
- println!("{:?}", self);
- }
- fn boo(a: usize) -> Self {
- Foo::Boo { a }
- }
- fn bar() -> Self {
- Foo::Bar
- }
- }
- Foo::boo(123).print();
- Foo::bar().print();
- }
Add Comment
Please, Sign In to add comment