use {super::super::all_types::*, crate::builder::prelude::*};
static INTERFACE: wl_interface = wl_interface {
name: c"wl_dummy".as_ptr(),
version: 1,
method_count: 3,
methods: {
static MESSAGES: [wl_message; 3] = [
wl_message {
name: c"destroy".as_ptr(),
signature: c"".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 0] = [];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"recycle".as_ptr(),
signature: c"n".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 1] =
[Some(WlDummy::WL_INTERFACE)];
TYPES.as_ptr().cast()
},
},
wl_message {
name: c"get_string".as_ptr(),
signature: c"n".as_ptr(),
types: {
static TYPES: [Option<&'static wl_interface>; 1] =
[Some(WlString::WL_INTERFACE)];
TYPES.as_ptr().cast()
},
},
];
MESSAGES.as_ptr()
},
event_count: 0,
events: ptr::null(),
};
#[derive(Clone, Eq, PartialEq)]
#[repr(transparent)]
pub struct WlDummy {
proxy: UntypedOwnedProxy,
}
#[derive(Eq, PartialEq)]
#[repr(transparent)]
pub struct WlDummyRef {
proxy: UntypedBorrowedProxy,
}
unsafe impl UntypedOwnedProxyWrapper for WlDummy {}
unsafe impl OwnedProxy for WlDummy {
const INTERFACE: &'static str = "wl_dummy";
const WL_INTERFACE: &'static wl_interface = &INTERFACE;
const NO_OP_EVENT_HANDLER: Self::NoOpEventHandler =
private::EventHandler(private::NoOpEventHandler);
const MAX_VERSION: u32 = 1;
type Borrowed = WlDummyRef;
type Api = private::ProxyApi;
type NoOpEventHandler = private::EventHandler<private::NoOpEventHandler>;
}
unsafe impl UntypedBorrowedProxyWrapper for WlDummyRef {}
unsafe impl BorrowedProxy for WlDummyRef {
type Owned = WlDummy;
}
impl Deref for WlDummy {
type Target = WlDummyRef;
fn deref(&self) -> &Self::Target {
proxy::low_level::deref(self)
}
}
mod private {
pub struct ProxyApi;
#[allow(dead_code)]
pub struct EventHandler<H>(pub(super) H);
#[allow(dead_code)]
pub struct NoOpEventHandler;
}
impl Debug for WlDummy {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "wl_dummy#{}", self.proxy.id())
}
}
impl Debug for WlDummyRef {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "wl_dummy#{}", self.proxy.id())
}
}
impl PartialEq<WlDummyRef> for WlDummy {
fn eq(&self, other: &WlDummyRef) -> bool {
self.proxy == other.proxy
}
}
impl PartialEq<WlDummy> for WlDummyRef {
fn eq(&self, other: &WlDummy) -> bool {
self.proxy == other.proxy
}
}
#[allow(dead_code)]
impl WlDummy {
#[allow(dead_code)]
pub const REQ__DESTROY__SINCE: u32 = 1;
#[inline]
pub fn destroy(&self) {
let mut args = [];
unsafe {
self.proxy.send_destructor(0, &mut args);
}
}
#[allow(dead_code)]
pub const REQ__RECYCLE__SINCE: u32 = 1;
#[inline]
pub fn recycle(&self) -> WlDummy {
let mut args = [wl_argument { n: 0 }];
let data = unsafe {
self.proxy
.send_constructor::<true>(1, &mut args, WlDummy::WL_INTERFACE, None)
};
unsafe { proxy::low_level::from_untyped_owned(data) }
}
#[allow(dead_code)]
pub const REQ__GET_STRING__SINCE: u32 = 1;
#[inline]
pub fn get_string(&self) -> WlString {
let mut args = [wl_argument { n: 0 }];
let data = unsafe {
self.proxy
.send_constructor::<false>(2, &mut args, WlString::WL_INTERFACE, None)
};
unsafe { proxy::low_level::from_untyped_owned(data) }
}
}
#[allow(dead_code)]
impl WlDummyRef {
#[inline]
pub fn get_string(&self, _queue: &Queue) -> WlString {
let mut args = [wl_argument { n: 0 }];
let data = unsafe {
self.proxy
.send_constructor(_queue, 2, &mut args, WlString::WL_INTERFACE, None)
};
unsafe { proxy::low_level::from_untyped_owned(data) }
}
}
#[allow(dead_code)]
pub trait WlDummyEventHandler {
type Data: 'static;
}
impl WlDummyEventHandler for private::NoOpEventHandler {
type Data = ();
}
unsafe impl<H> EventHandler for private::EventHandler<H>
where
H: WlDummyEventHandler,
{
const WL_INTERFACE: &'static wl_interface = &INTERFACE;
#[inline]
fn mutable_type() -> Option<(TypeId, &'static str)> {
let id = TypeId::of::<H::Data>();
let name = std::any::type_name::<H::Data>();
Some((id, name))
}
#[allow(unused_variables)]
unsafe fn handle_event(
&self,
queue: &Queue,
data: *mut u8,
slf: &UntypedBorrowedProxy,
opcode: u32,
args: *mut wl_argument,
) {
invalid_opcode("wl_dummy", opcode);
}
}
impl<H> CreateEventHandler<H> for private::ProxyApi
where
H: WlDummyEventHandler,
{
type EventHandler = private::EventHandler<H>;
#[inline]
fn create_event_handler(handler: H) -> Self::EventHandler {
private::EventHandler(handler)
}
}
pub mod event_handlers {
use super::*;
impl WlDummy {}
}