Guest User

Untitled

a guest
May 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. fn main() {
  2. let array_gen = {
  3. let anta = Antagonist::default();
  4.  
  5. anta.to_array()
  6. };
  7.  
  8.  
  9. }
  10.  
  11.  
  12. #[derive(Debug, Default)]
  13. pub struct Antagonist {
  14. a: usize,
  15. b: usize
  16. }
  17.  
  18.  
  19. impl Antagonist {
  20.  
  21. pub fn to_array(&self) -> &[u8] {
  22. match self.a + self.b {
  23. 0 => b"SRN",
  24. _ => b"NTN",
  25. }
  26. }
  27.  
  28. pub fn to_array2<'a>(&self) -> &'a [u8] {
  29. match self.a + self.b {
  30. 0 => b"SRN",
  31. _ => b"NTN",
  32. }
  33. }
  34. }
Add Comment
Please, Sign In to add comment