instruction.rs 685 B

12345678910111213141516171819202122232425
  1. use steel::*;
  2. /// Used in generating the discriminats for instructions
  3. #[repr(u8)]
  4. #[derive(Clone, Copy, Debug, Eq, PartialEq, TryFromPrimitive)]
  5. pub enum MyInstruction {
  6. /// Create account discriminant represented by `0`
  7. CreateAccount = 0,
  8. /// Close account discriminant represented by `1`
  9. CloseAccount = 1,
  10. }
  11. /// Create account struct with the name
  12. /// as an array of 64 bytes
  13. #[repr(C)]
  14. #[derive(Clone, Copy, Debug, Pod, Zeroable)]
  15. pub struct CreateAccount(pub [u8; 64]);
  16. /// UsedClose Account
  17. #[repr(C)]
  18. #[derive(Clone, Copy, Debug, Pod, Zeroable)]
  19. pub struct CloseAccount;
  20. instruction!(MyInstruction, CreateAccount);
  21. instruction!(MyInstruction, CloseAccount);