bnr_xfs/cash_unit/
status.rs1use std::fmt;
2
3use crate::impl_xfs_i4;
4
5#[repr(C)]
7#[derive(Clone, Copy, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8pub struct Status(u32);
9
10impl Status {
11 pub const fn new() -> Self {
13 Self(0)
14 }
15
16 pub const fn create(v: u32) -> Self {
18 Self(v)
19 }
20
21 pub const fn inner(&self) -> u32 {
23 self.0
24 }
25
26 pub fn set_inner(&mut self, v: u32) {
28 self.0 = v;
29 }
30
31 pub fn into_inner(self) -> u32 {
33 self.0
34 }
35}
36
37impl fmt::Display for Status {
38 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39 write!(f, "{}", self.inner())
40 }
41}
42
43impl_xfs_i4!(Status, "status");