Guest User

Untitled

a guest
Jan 18th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. use std::fmt;
  2.  
  3. enum Cbw {
  4. Cbw20,
  5. Cbw40,
  6. Cbw40Below,
  7. Cbw80,
  8. Cbw160,
  9. Cbw80PB0 { secondary80: usize },
  10. }
  11.  
  12. impl fmt::Display for Cbw {
  13. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
  14. let owned_suffix;
  15. let suffix = match self {
  16. Cbw::Cbw20 => "",
  17. Cbw::Cbw40 => "+",
  18. Cbw::Cbw40Below => "-",
  19. Cbw::Cbw80 => "V",
  20. Cbw::Cbw160 => "W",
  21. Cbw::Cbw80PB0 { secondary80 } => {
  22. owned_suffix = format!("{:?}", secondary80);
  23. &owned_suffix
  24. }
  25. };
  26. write!(f, "{}", suffix)
  27. }
  28. }
  29.  
  30. fn main() {
  31.  
  32. }
Add Comment
Please, Sign In to add comment