1
0
Fork 0
forked from wry/wry

wire: generate trait for request handling

This commit is contained in:
Julian Orth 2024-04-08 17:37:35 +02:00
parent e3a1a0b30f
commit acb391335b
102 changed files with 1632 additions and 2086 deletions

View file

@ -5,7 +5,6 @@ use {
ifs::zxdg_output_v1::ZxdgOutputV1,
leaks::Tracker,
object::{Object, Version},
utils::buffd::{MsgParser, MsgParserError},
wire::{zxdg_output_manager_v1::*, ZxdgOutputManagerV1Id},
},
std::rc::Rc,
@ -46,18 +45,15 @@ impl ZxdgOutputManagerV1Global {
}
}
impl ZxdgOutputManagerV1 {
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZxdgOutputManagerV1Error> {
let _req: Destroy = self.client.parse(self, parser)?;
impl ZxdgOutputManagerV1RequestHandler for ZxdgOutputManagerV1 {
type Error = ZxdgOutputManagerV1Error;
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
self.client.remove_obj(self)?;
Ok(())
}
fn get_xdg_output(
self: &Rc<Self>,
parser: MsgParser<'_, '_>,
) -> Result<(), ZxdgOutputManagerV1Error> {
let req: GetXdgOutput = self.client.parse(&**self, parser)?;
fn get_xdg_output(&self, req: GetXdgOutput, _slf: &Rc<Self>) -> Result<(), Self::Error> {
let output = self.client.lookup(req.output)?;
let xdg_output = Rc::new(ZxdgOutputV1 {
id: req.id,
@ -94,9 +90,7 @@ simple_add_global!(ZxdgOutputManagerV1Global);
object_base! {
self = ZxdgOutputManagerV1;
DESTROY => destroy,
GET_XDG_OUTPUT => get_xdg_output,
version = self.version;
}
simple_add_obj!(ZxdgOutputManagerV1);
@ -107,8 +101,5 @@ impl Object for ZxdgOutputManagerV1 {}
pub enum ZxdgOutputManagerV1Error {
#[error(transparent)]
ClientError(Box<ClientError>),
#[error("Parsing failed")]
MsgParserError(#[source] Box<MsgParserError>),
}
efrom!(ZxdgOutputManagerV1Error, ClientError);
efrom!(ZxdgOutputManagerV1Error, MsgParserError);