#![warn(missing_docs)]
extern crate nix;
extern crate wayland_sys;
use std::os::raw::c_void;
use wayland_sys::common as syscom;
pub mod map;
pub mod sinks;
pub mod socket;
pub mod utils;
pub mod wire;
pub trait MessageGroup: Sized {
const MESSAGES: &'static [wire::MessageDesc];
type Map;
fn opcode(&self) -> u16;
fn is_destructor(&self) -> bool;
fn since(&self) -> u32;
fn child<Meta: self::map::ObjectMetadata>(
opcode: u16,
version: u32,
meta: &Meta,
) -> Option<::map::Object<Meta>>;
fn from_raw(msg: wire::Message, map: &mut Self::Map) -> Result<Self, ()>;
fn into_raw(self, send_id: u32) -> wire::Message;
unsafe fn from_raw_c(obj: *mut c_void, opcode: u32, args: *const syscom::wl_argument)
-> Result<Self, ()>;
fn as_raw_c_in<F, T>(self, f: F) -> T
where
F: FnOnce(u32, &mut [syscom::wl_argument]) -> T;
}
pub trait Interface: 'static {
type Request: MessageGroup + 'static;
type Event: MessageGroup + 'static;
const NAME: &'static str;
const VERSION: u32;
fn c_interface() -> *const ::syscom::wl_interface;
}
pub enum NoMessage {}
#[cfg_attr(tarpaulin, skip)]
impl MessageGroup for NoMessage {
const MESSAGES: &'static [wire::MessageDesc] = &[];
type Map = ();
fn is_destructor(&self) -> bool {
match *self {}
}
fn opcode(&self) -> u16 {
match *self {}
}
fn since(&self) -> u32 {
match *self {}
}
fn child<M: self::map::ObjectMetadata>(_: u16, _: u32, _: &M) -> Option<::map::Object<M>> {
None
}
fn from_raw(_: wire::Message, _: &mut ()) -> Result<Self, ()> {
Err(())
}
fn into_raw(self, _: u32) -> wire::Message {
match self {}
}
unsafe fn from_raw_c(
_obj: *mut c_void,
_opcode: u32,
_args: *const syscom::wl_argument,
) -> Result<Self, ()> {
Err(())
}
fn as_raw_c_in<F, T>(self, _f: F) -> T
where
F: FnOnce(u32, &mut [syscom::wl_argument]) -> T,
{
match self {}
}
}