1
0
Fork 0
forked from wry/wry

autocommit 2022-01-02 20:11:25 CET

This commit is contained in:
Julian Orth 2022-01-02 20:11:25 +01:00
parent c21f231ce7
commit fc887b339e
29 changed files with 672 additions and 197 deletions

View file

@ -4,7 +4,7 @@ use crate::client::{AddObj, Client};
use crate::globals::{Global, GlobalName};
use crate::ifs::wl_shm_pool::WlShmPool;
use crate::object::{Interface, Object, ObjectId};
use crate::utils::buffd::WlParser;
use crate::utils::buffd::MsgParser;
use std::rc::Rc;
pub use types::*;
@ -52,7 +52,7 @@ impl WlShmGlobal {
}
impl WlShmObj {
async fn create_pool(&self, parser: WlParser<'_, '_>) -> Result<(), CreatePoolError> {
async fn create_pool(&self, parser: MsgParser<'_, '_>) -> Result<(), CreatePoolError> {
let create: CreatePool = self.client.parse(self, parser)?;
if create.size < 0 {
return Err(CreatePoolError::NegativeSize);
@ -70,7 +70,7 @@ impl WlShmObj {
async fn handle_request_(
&self,
request: u32,
parser: WlParser<'_, '_>,
parser: MsgParser<'_, '_>,
) -> Result<(), WlShmError> {
match request {
CREATE_POOL => self.create_pool(parser).await?,

View file

@ -2,7 +2,7 @@ use crate::client::{ClientError, EventFormatter, RequestParser};
use crate::ifs::wl_shm::{Format, WlShmObj, FORMAT};
use crate::ifs::wl_shm_pool::WlShmPoolError;
use crate::object::{Object, ObjectId};
use crate::utils::buffd::{WlFormatter, WlParser, WlParserError};
use crate::utils::buffd::{MsgFormatter, MsgParser, MsgParserError};
use std::fmt::{Debug, Formatter};
use std::rc::Rc;
use thiserror::Error;
@ -20,7 +20,7 @@ efrom!(WlShmError, ClientError, ClientError);
#[derive(Debug, Error)]
pub enum CreatePoolError {
#[error("Parsing failed")]
ParseError(#[source] Box<WlParserError>),
ParseError(#[source] Box<MsgParserError>),
#[error("The passed size is negative")]
NegativeSize,
#[error(transparent)]
@ -28,7 +28,7 @@ pub enum CreatePoolError {
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(CreatePoolError, ParseError, WlParserError);
efrom!(CreatePoolError, ParseError, MsgParserError);
efrom!(CreatePoolError, WlShmPoolError, WlShmPoolError);
efrom!(CreatePoolError, ClientError, ClientError);
@ -38,7 +38,7 @@ pub(super) struct CreatePool {
pub size: i32,
}
impl RequestParser<'_> for CreatePool {
fn parse(parser: &mut WlParser<'_, '_>) -> Result<Self, WlParserError> {
fn parse(parser: &mut MsgParser<'_, '_>) -> Result<Self, MsgParserError> {
Ok(Self {
id: parser.object()?,
fd: parser.fd()?,
@ -63,7 +63,7 @@ pub(super) struct FormatE {
pub format: Format,
}
impl EventFormatter for FormatE {
fn format(self: Box<Self>, fmt: &mut WlFormatter<'_>) {
fn format(self: Box<Self>, fmt: &mut MsgFormatter<'_>) {
fmt.header(self.obj.id, FORMAT).uint(self.format.uint());
}
fn obj(&self) -> &dyn Object {