Guest User

Untitled

a guest
Oct 19th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #[derive(Debug)]
  2. pub enum GizmoType {
  3. Foo,
  4. Bar
  5. }
  6.  
  7. #[derive(Debug)]
  8. pub struct Gizmo
  9. {
  10. ty: GizmoType
  11. }
  12.  
  13. pub type Widget = Gizmo;
  14.  
  15. pub type WidgetType = GizmoType; // Option 1, doesn't work!
  16. //use GizmoType as WidgetType; // Option 2, works!
  17.  
  18. fn main() {
  19.  
  20. let widget = Widget {
  21. ty: WidgetType::Foo
  22. };
  23.  
  24. println!("Widget: {:?}", widget);
  25.  
  26. }
Add Comment
Please, Sign In to add comment