work_info.rs 646 B

123456789101112131415161718192021222324252627
  1. use crate::consts::*;
  2. use crate::utils::*;
  3. use steel::*;
  4. use super::ReallocAccount;
  5. #[repr(C)]
  6. #[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
  7. pub struct WorkInfo {
  8. pub name: [u8; MAX_STR_LEN],
  9. pub position: [u8; MAX_STR_LEN],
  10. pub company: [u8; MAX_STR_LEN],
  11. pub years_employed: u8,
  12. }
  13. impl WorkInfo {
  14. pub fn new(name: &str, position: &str, company: &str, years_employed: u8) -> Self {
  15. WorkInfo {
  16. name: str_to_bytes(name),
  17. position: str_to_bytes(position),
  18. company: str_to_bytes(company),
  19. years_employed,
  20. }
  21. }
  22. }
  23. account!(ReallocAccount, WorkInfo);