wayland_backend/types/
server.rs1use crate::protocol::Interface;
2
3#[derive(Debug)]
5pub struct GlobalInfo {
6    pub interface: &'static Interface,
8    pub version: u32,
10    pub disabled: bool,
12}
13
14#[derive(Debug)]
16pub enum InitError {
17    NoWaylandLib,
19    Io(std::io::Error),
21}
22
23impl std::error::Error for InitError {
24    #[cfg_attr(coverage, coverage(off))]
25    fn cause(&self) -> Option<&dyn std::error::Error> {
26        match self {
27            InitError::Io(ref err) => Some(err),
28            InitError::NoWaylandLib => None,
29        }
30    }
31}
32
33impl std::fmt::Display for InitError {
34    #[cfg_attr(coverage, coverage(off))]
35    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
36        match self {
37            InitError::Io(ref err) => std::fmt::Display::fmt(err, f),
38            InitError::NoWaylandLib => f.write_str("could not load libwayland-server.so"),
39        }
40    }
41}
42
43#[derive(Clone, Debug)]
45pub struct InvalidId;
46
47impl std::error::Error for InvalidId {}
48
49impl std::fmt::Display for InvalidId {
50    #[cfg_attr(coverage, coverage(off))]
51    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
52        write!(f, "Invalid Id")
53    }
54}
55
56#[derive(Debug)]
58pub enum DisconnectReason {
59    ConnectionClosed,
61    ProtocolError(crate::protocol::ProtocolError),
63}
64
65#[derive(Debug, Clone, Copy)]
67pub struct Credentials {
68    pub pid: rustix::process::RawPid,
70    pub uid: rustix::process::RawUid,
72    pub gid: rustix::process::RawGid,
74}