screencapturekit/cm/
frame_status.rs1use std::fmt;
4
5#[repr(i32)]
10#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
11pub enum SCFrameStatus {
12 #[default]
14 Complete = 0,
15 Idle = 1,
17 Blank = 2,
19 Suspended = 3,
21 Started = 4,
23 Stopped = 5,
25}
26
27impl SCFrameStatus {
28 pub const fn from_raw(value: i32) -> Option<Self> {
30 match value {
31 0 => Some(Self::Complete),
32 1 => Some(Self::Idle),
33 2 => Some(Self::Blank),
34 3 => Some(Self::Suspended),
35 4 => Some(Self::Started),
36 5 => Some(Self::Stopped),
37 _ => None,
38 }
39 }
40
41 pub const fn has_content(self) -> bool {
43 matches!(self, Self::Complete | Self::Started)
44 }
45
46 pub const fn is_complete(self) -> bool {
48 matches!(self, Self::Complete)
49 }
50}
51
52impl fmt::Display for SCFrameStatus {
53 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
54 match self {
55 Self::Complete => write!(f, "Complete"),
56 Self::Idle => write!(f, "Idle"),
57 Self::Blank => write!(f, "Blank"),
58 Self::Suspended => write!(f, "Suspended"),
59 Self::Started => write!(f, "Started"),
60 Self::Stopped => write!(f, "Stopped"),
61 }
62 }
63}