wayland_protocols_async/zwlr_output_management_v1/
errors.rs1use std::fmt;
2
3#[derive(Debug, Default, Clone, Copy)]
4pub enum OutputManagementHandlerErrorCodes {
5 #[default]
6 UnknownError,
7 RemoveModeError,
8 HeadNotFoundError,
9 ModeNotFoundError,
10 NoSerialManagerNotReady
11}
12
13impl fmt::Display for OutputManagementHandlerErrorCodes {
14 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15 match self {
16 OutputManagementHandlerErrorCodes::UnknownError => write!(f, "OutputManagementHandlerErrorCodes: UnknownError"),
17 OutputManagementHandlerErrorCodes::RemoveModeError => {
18 write!(f, "OutputManagementHandlerErrorCodes: RemoveModeError")
19 },
20 OutputManagementHandlerErrorCodes::HeadNotFoundError => {
21 write!(f, "OutputManagementHandlerErrorCodes: HeadNotFoundError")
22 },
23 OutputManagementHandlerErrorCodes::ModeNotFoundError => {
24 write!(f, "OutputManagementHandlerErrorCodes: ModeNotFoundError")
25 },
26 OutputManagementHandlerErrorCodes::NoSerialManagerNotReady => {
27 write!(f, "OutputManagementHandlerErrorCodes: NoSerialManagerNotReady")
28 }
29 }
30 }
31}
32
33#[derive(Debug)]
34pub struct OutputManagementHandlerError {
35 pub code: OutputManagementHandlerErrorCodes,
36 pub message: String,
37}
38
39impl std::fmt::Display for OutputManagementHandlerError {
40 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
41 write!(
42 f,
43 "OutputManagementHandlerErrorCodes:(code: {:?}, message: {})",
44 self.code, self.message
45 )
46 }
47}
48
49impl OutputManagementHandlerError {
50 pub fn new(code: OutputManagementHandlerErrorCodes, message: String) -> Self {
51 Self { code, message }
52 }
53}