use crate::protocol::Interface;
#[derive(Debug)]
pub struct GlobalInfo {
pub interface: &'static Interface,
pub version: u32,
pub disabled: bool,
}
#[derive(Debug)]
pub enum InitError {
NoWaylandLib,
Io(std::io::Error),
}
impl std::error::Error for InitError {
#[cfg_attr(coverage, no_coverage)]
fn cause(&self) -> Option<&dyn std::error::Error> {
match self {
InitError::Io(ref err) => Some(err),
InitError::NoWaylandLib => None,
}
}
}
impl std::fmt::Display for InitError {
#[cfg_attr(coverage, no_coverage)]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
match self {
InitError::Io(ref err) => std::fmt::Display::fmt(err, f),
InitError::NoWaylandLib => f.write_str("could not load libwayland-server.so"),
}
}
}
#[derive(Clone, Debug)]
pub struct InvalidId;
impl std::error::Error for InvalidId {}
impl std::fmt::Display for InvalidId {
#[cfg_attr(coverage, no_coverage)]
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
write!(f, "Invalid Id")
}
}
#[derive(Debug)]
pub enum DisconnectReason {
ConnectionClosed,
ProtocolError(crate::protocol::ProtocolError),
}
#[derive(Debug, Clone, Copy)]
pub struct Credentials {
pub pid: nix::libc::pid_t,
pub uid: nix::libc::uid_t,
pub gid: nix::libc::gid_t,
}