Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let array_gen = {
- let anta = Antagonist::default();
- anta.to_array()
- };
- }
- #[derive(Debug, Default)]
- pub struct Antagonist {
- a: usize,
- b: usize
- }
- impl Antagonist {
- pub fn to_array(&self) -> &[u8] {
- match self.a + self.b {
- 0 => b"SRN",
- _ => b"NTN",
- }
- }
- pub fn to_array2<'a>(&self) -> &'a [u8] {
- match self.a + self.b {
- 0 => b"SRN",
- _ => b"NTN",
- }
- }
- }
Add Comment
Please, Sign In to add comment