From a823f97615d7e55ba117329c61fa78183f20478a Mon Sep 17 00:00:00 2001 From: Syudagye Date: Sun, 19 Feb 2023 10:30:06 +0100 Subject: [PATCH 1/9] Implemented the "Big Requests" extented length field + Added `big-requests` feature to manage this extension --- Cargo.toml | 7 ++++++ src/message.rs | 15 +++++++++++++ src/x11/request/graphics.rs | 22 +++++++++++++++++++ src/x11/request/input.rs | 10 ++++++++- .../src/definition/expansion/message_trait.rs | 7 ++++++ .../src/definition/expansion/readable.rs | 8 +++++++ .../src/definition/expansion/writable.rs | 21 ++++++++++++++++++ 7 files changed, 89 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b55e70f6..b352c9f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,15 @@ keywords = [ "x11", "xorg", "xproto", "xrs", "window" ] categories = [ "data-structures", "api-bindings", "encoding" ] [features] +default = ["big-requests"] try = [] +# Protocol Extentions + +# Big Requests +# https://www.x.org/releases/X11R7.7/doc/bigreqsproto/bigreq.html +big-requests = [] + [workspace] # XRB is defined as a workspace that automatically includes all its path # dependencies. Currently, that means `xrb-proc-macros` and `cornflakes`. diff --git a/src/message.rs b/src/message.rs index e09a1efa..80e24c1c 100644 --- a/src/message.rs +++ b/src/message.rs @@ -123,6 +123,7 @@ pub trait Request: X11Size + Writable { /// } /// } /// ``` + #[cfg(not(feature = "big-requests"))] #[allow(clippy::cast_possible_truncation)] fn length(&self) -> u16 { let size = self.x11_size(); @@ -135,6 +136,20 @@ pub trait Request: X11Size + Writable { (size / 4) as u16 } + + #[cfg(feature = "big-requests")] + #[allow(clippy::cast_possible_truncation)] + fn length(&self) -> u32 { + let size = self.x11_size(); + + assert_eq!( + size % 4, + 0, + "expected Request size to be a multiple of 4, found {size}" + ); + + (size / 4) as u32 + } } /// The result of sending a [request]. diff --git a/src/x11/request/graphics.rs b/src/x11/request/graphics.rs index 168309f3..ce6470ed 100644 --- a/src/x11/request/graphics.rs +++ b/src/x11/request/graphics.rs @@ -2102,7 +2102,18 @@ impl Writable for DrawText8 { buf.put_u8(Self::MAJOR_OPCODE); // Unused metabyte position. buf.put_u8(0); + #[cfg(not(feature = "big-requests"))] buf.put_u16(self.length()); + #[cfg(feature = "big-requests")] + { + let length = self.length(); + if let Ok(length) = length.try_into() { + buf.put_u16(length); + } else { + buf.put_u16(0); + buf.put_u32(length); + } + } self.target.write_to(buf)?; self.graphics_context.write_to(buf)?; @@ -2470,7 +2481,18 @@ impl Writable for DrawText16 { buf.put_u8(Self::MAJOR_OPCODE); // Unused metabyte position. buf.put_u8(0); + #[cfg(not(feature = "big-requests"))] buf.put_u16(self.length()); + #[cfg(feature = "big-requests")] + { + let length = self.length(); + if let Ok(length) = length.try_into() { + buf.put_u16(length); + } else { + buf.put_u16(0); + buf.put_u32(length); + } + } self.target.write_to(buf)?; self.graphics_context.write_to(buf)?; diff --git a/src/x11/request/input.rs b/src/x11/request/input.rs index efb6f949..9f1ff82d 100644 --- a/src/x11/request/input.rs +++ b/src/x11/request/input.rs @@ -22,7 +22,7 @@ use xrbk::{ Readable, Writable, WriteResult, - X11Size, + X11Size, WriteError, }; use xrbk_macro::{derive_xrb, Readable, Writable, X11Size}; @@ -1439,7 +1439,15 @@ impl Writable for ChangeKeyboardMapping WriteResult { // Limit `buf` by the length (converted to bytes). + #[cfg(not(feature = "big-requests"))] let buf = &mut buf.limit(usize::from(self.length()) * 4); + #[cfg(feature = "big-requests")] + let buf = &mut buf.limit({ + let Ok(size) = (self.length() * 4).try_into() else { + return Err(WriteError::Other(Box::new("Unable to allocate buffer"))); + }; + size + }); // The major opcode. Self::MAJOR_OPCODE.write_to(buf)?; diff --git a/xrbk_macro/src/definition/expansion/message_trait.rs b/xrbk_macro/src/definition/expansion/message_trait.rs index 393e6ba8..047e4005 100644 --- a/xrbk_macro/src/definition/expansion/message_trait.rs +++ b/xrbk_macro/src/definition/expansion/message_trait.rs @@ -55,10 +55,17 @@ impl Request { #minor_opcode }; + #[cfg(not(feature = "big-requests"))] #[allow(clippy::cast_possible_truncation)] fn length(&self) -> u16 { (::x11_size(self) / 4) as u16 } + + #[cfg(feature = "big-requests")] + #[allow(clippy::cast_possible_truncation)] + fn length(&self) -> u32 { + (::x11_size(self) / 4) as u32 + } } ) }); diff --git a/xrbk_macro/src/definition/expansion/readable.rs b/xrbk_macro/src/definition/expansion/readable.rs index 9f2187c1..db6425b9 100644 --- a/xrbk_macro/src/definition/expansion/readable.rs +++ b/xrbk_macro/src/definition/expansion/readable.rs @@ -128,7 +128,15 @@ impl Request { // read. #metabyte // Read the request's length. + #[cfg(not(feature = "big-requests"))] let length = <_ as ::xrbk::Buf>::get_u16(buf); + #[cfg(feature = "big-requests")] + let mut length = <_ as ::xrbk::Buf>::get_u16(buf) as u32; + #[cfg(feature = "big-requests")] + if length == 0 { + length = <_ as ::xrbk::Buf>::get_u32(buf); + } + let buf = &mut <_ as ::xrbk::Buf>::take( buf, ((length - 1) as usize) * 4, diff --git a/xrbk_macro/src/definition/expansion/writable.rs b/xrbk_macro/src/definition/expansion/writable.rs index 24a989ae..fdf7f30a 100644 --- a/xrbk_macro/src/definition/expansion/writable.rs +++ b/xrbk_macro/src/definition/expansion/writable.rs @@ -137,10 +137,31 @@ impl Request { // Metabyte position #metabyte // Length + #[cfg(not(feature = "big-requests"))] <_ as ::xrbk::BufMut>::put_u16( buf, ::length(&self), ); + #[cfg(feature = "big-requests")] + { + let length = ::length(&self); + // If it can fit into a u16, then we don't need the extended length field + if let Ok(length) = length.try_into() { + <_ as ::xrbk::BufMut>::put_u16( + buf, + length, + ); + } else { + <_ as ::xrbk::BufMut>::put_u16( + buf, + 0, + ); + <_ as ::xrbk::BufMut>::put_u32( + buf, + length, + ); + } + } // Other elements #writes From 21aad0c3a2ab23dee59e0341c90f79b1f87699f5 Mon Sep 17 00:00:00 2001 From: Syudagye Date: Sun, 19 Feb 2023 11:10:55 +0100 Subject: [PATCH 2/9] Added `BigRequestsEnable` request and reply --- src/big_requests.rs | 8 ++++++++ src/big_requests/reply.rs | 22 ++++++++++++++++++++++ src/big_requests/request.rs | 16 ++++++++++++++++ src/lib.rs | 5 +++++ 4 files changed, 51 insertions(+) create mode 100644 src/big_requests.rs create mode 100644 src/big_requests/reply.rs create mode 100644 src/big_requests/request.rs diff --git a/src/big_requests.rs b/src/big_requests.rs new file mode 100644 index 00000000..58e18ab4 --- /dev/null +++ b/src/big_requests.rs @@ -0,0 +1,8 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +//! Request to enable extended length field in the protocol. + +pub mod request; +pub mod reply; diff --git a/src/big_requests/reply.rs b/src/big_requests/reply.rs new file mode 100644 index 00000000..23e58171 --- /dev/null +++ b/src/big_requests/reply.rs @@ -0,0 +1,22 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +extern crate self as xrb; + +use crate::{big_requests::request, message::Reply}; +use derivative::Derivative; +use xrbk_macro::derive_xrb; + +derive_xrb! { + #[derive(Derivative, Debug, X11Size, Readable, Writable)] + #[derivative(Hash, PartialEq, Eq)] + pub struct BigRequestsEnable: Reply for request::BigRequestsEnable { + #[sequence] + #[derivative(Hash = "ignore", PartialEq = "ignore")] + pub sequence: u16, + + pub maximum_request_length: u32, + [_; 2], + } +} diff --git a/src/big_requests/request.rs b/src/big_requests/request.rs new file mode 100644 index 00000000..81f168fc --- /dev/null +++ b/src/big_requests/request.rs @@ -0,0 +1,16 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +extern crate self as xrb; + +use derivative::Derivative; +use xrbk_macro::derive_xrb; +use crate::message::Request; +use crate::big_requests::reply; + +derive_xrb!{ + #[derive(Derivative, Debug, X11Size, Readable, Writable)] + #[derivative(Hash, PartialEq, Eq)] + pub struct BigRequestsEnable: Request(0) -> reply::BigRequestsEnable {} +} diff --git a/src/lib.rs b/src/lib.rs index c8e2e4ac..1bd347f9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -87,3 +87,8 @@ pub mod connection; pub mod message; pub mod unit; pub mod x11; + +// Protocol Extensions + +#[cfg(feature = "big-requests")] +pub mod big_requests; From 32f23306b784014fdac9d1730225394c697bf56f Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 19 Feb 2023 10:15:00 +0000 Subject: [PATCH 3/9] [CI978] formatted code with rustfmt --- src/big_requests.rs | 2 +- src/big_requests/request.rs | 5 ++--- src/x11/request/input.rs | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/big_requests.rs b/src/big_requests.rs index 58e18ab4..b74d80cb 100644 --- a/src/big_requests.rs +++ b/src/big_requests.rs @@ -4,5 +4,5 @@ //! Request to enable extended length field in the protocol. -pub mod request; pub mod reply; +pub mod request; diff --git a/src/big_requests/request.rs b/src/big_requests/request.rs index 81f168fc..69228fea 100644 --- a/src/big_requests/request.rs +++ b/src/big_requests/request.rs @@ -4,12 +4,11 @@ extern crate self as xrb; +use crate::{big_requests::reply, message::Request}; use derivative::Derivative; use xrbk_macro::derive_xrb; -use crate::message::Request; -use crate::big_requests::reply; -derive_xrb!{ +derive_xrb! { #[derive(Derivative, Debug, X11Size, Readable, Writable)] #[derivative(Hash, PartialEq, Eq)] pub struct BigRequestsEnable: Request(0) -> reply::BigRequestsEnable {} diff --git a/src/x11/request/input.rs b/src/x11/request/input.rs index 9f1ff82d..0b0ac777 100644 --- a/src/x11/request/input.rs +++ b/src/x11/request/input.rs @@ -21,8 +21,9 @@ use xrbk::{ ReadResult, Readable, Writable, + WriteError, WriteResult, - X11Size, WriteError, + X11Size, }; use xrbk_macro::{derive_xrb, Readable, Writable, X11Size}; From e8255d4631560a595781f88c36cd80ee25d6b8a4 Mon Sep 17 00:00:00 2001 From: Syudagye <44324659+Syudagye@users.noreply.github.com> Date: Sun, 26 Feb 2023 19:47:22 +0100 Subject: [PATCH 4/9] Apply suggestions from code review Co-authored-by: Antikyth <104020300+Antikyth@users.noreply.github.com> --- src/big_requests/request.rs | 2 +- src/x11/request/input.rs | 12 ++++++------ xrbk_macro/src/definition/expansion/readable.rs | 9 ++++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/big_requests/request.rs b/src/big_requests/request.rs index 69228fea..0da6eee7 100644 --- a/src/big_requests/request.rs +++ b/src/big_requests/request.rs @@ -11,5 +11,5 @@ use xrbk_macro::derive_xrb; derive_xrb! { #[derive(Derivative, Debug, X11Size, Readable, Writable)] #[derivative(Hash, PartialEq, Eq)] - pub struct BigRequestsEnable: Request(0) -> reply::BigRequestsEnable {} + pub struct BigRequestsEnable: Request(todo!("extensions use dynamic major opcodes")) -> reply::BigRequestsEnable {} } diff --git a/src/x11/request/input.rs b/src/x11/request/input.rs index 0b0ac777..40e7ff31 100644 --- a/src/x11/request/input.rs +++ b/src/x11/request/input.rs @@ -1443,12 +1443,12 @@ impl Writable for ChangeKeyboardMapping size * 4, + + Err(error) => return Err(WriteError::Other(Box::new(error))), + }; + let buf = &mut buf.limit(size); // The major opcode. Self::MAJOR_OPCODE.write_to(buf)?; diff --git a/xrbk_macro/src/definition/expansion/readable.rs b/xrbk_macro/src/definition/expansion/readable.rs index db6425b9..17d54eb7 100644 --- a/xrbk_macro/src/definition/expansion/readable.rs +++ b/xrbk_macro/src/definition/expansion/readable.rs @@ -131,11 +131,10 @@ impl Request { #[cfg(not(feature = "big-requests"))] let length = <_ as ::xrbk::Buf>::get_u16(buf); #[cfg(feature = "big-requests")] - let mut length = <_ as ::xrbk::Buf>::get_u16(buf) as u32; - #[cfg(feature = "big-requests")] - if length == 0 { - length = <_ as ::xrbk::Buf>::get_u32(buf); - } + let length = match <_ as ::xrbk::Buf>::get_u16(buf) as u32 { + 0 => <_ as ::xrbk::Buf>::get_u32(buf), + length => length, + }; let buf = &mut <_ as ::xrbk::Buf>::take( buf, From ea8397d19256e2c2156406e7c56915c93cd4429e Mon Sep 17 00:00:00 2001 From: Syudagye Date: Sun, 26 Feb 2023 20:33:09 +0100 Subject: [PATCH 5/9] Changed syntax for extended length field filling + Renamed request and response --- src/big_requests/reply.rs | 2 +- src/big_requests/request.rs | 2 +- src/x11/request/graphics.rs | 44 +++++++++---------- .../src/definition/expansion/writable.rs | 29 ++++++------ 4 files changed, 37 insertions(+), 40 deletions(-) diff --git a/src/big_requests/reply.rs b/src/big_requests/reply.rs index 23e58171..ca0f7f4a 100644 --- a/src/big_requests/reply.rs +++ b/src/big_requests/reply.rs @@ -11,7 +11,7 @@ use xrbk_macro::derive_xrb; derive_xrb! { #[derive(Derivative, Debug, X11Size, Readable, Writable)] #[derivative(Hash, PartialEq, Eq)] - pub struct BigRequestsEnable: Reply for request::BigRequestsEnable { + pub struct EnableBigRequests: Reply for request::EnableBigRequests { #[sequence] #[derivative(Hash = "ignore", PartialEq = "ignore")] pub sequence: u16, diff --git a/src/big_requests/request.rs b/src/big_requests/request.rs index 0da6eee7..c6d76eb1 100644 --- a/src/big_requests/request.rs +++ b/src/big_requests/request.rs @@ -11,5 +11,5 @@ use xrbk_macro::derive_xrb; derive_xrb! { #[derive(Derivative, Debug, X11Size, Readable, Writable)] #[derivative(Hash, PartialEq, Eq)] - pub struct BigRequestsEnable: Request(todo!("extensions use dynamic major opcodes")) -> reply::BigRequestsEnable {} + pub struct EnableBigRequests: Request(0 /* TODO: extensions use dynamic major opcodes */) -> reply::EnableBigRequests {} } diff --git a/src/x11/request/graphics.rs b/src/x11/request/graphics.rs index ce6470ed..0988f750 100644 --- a/src/x11/request/graphics.rs +++ b/src/x11/request/graphics.rs @@ -86,6 +86,24 @@ request_error! { } } +/// Writes the length of the request to the provided buffer. +fn write_size(request: &impl Request, buf: &mut impl BufMut) { + #[cfg(not(feature = "big-requests"))] + buf.put_u16(request.length()); + #[cfg(feature = "big-requests")] + { + let length = request.length(); + match u16::try_from(length) { + Ok(length) => buf.put_u16(length), + // length is too big for u16, using the extended length field + Err(_) => { + buf.put_u16(0); + buf.put_u32(length); + }, + } + } +} + derive_xrb! { /// A [request] that clears a particular area of a [window]. /// @@ -2102,18 +2120,7 @@ impl Writable for DrawText8 { buf.put_u8(Self::MAJOR_OPCODE); // Unused metabyte position. buf.put_u8(0); - #[cfg(not(feature = "big-requests"))] - buf.put_u16(self.length()); - #[cfg(feature = "big-requests")] - { - let length = self.length(); - if let Ok(length) = length.try_into() { - buf.put_u16(length); - } else { - buf.put_u16(0); - buf.put_u32(length); - } - } + write_size(self, buf); self.target.write_to(buf)?; self.graphics_context.write_to(buf)?; @@ -2481,18 +2488,7 @@ impl Writable for DrawText16 { buf.put_u8(Self::MAJOR_OPCODE); // Unused metabyte position. buf.put_u8(0); - #[cfg(not(feature = "big-requests"))] - buf.put_u16(self.length()); - #[cfg(feature = "big-requests")] - { - let length = self.length(); - if let Ok(length) = length.try_into() { - buf.put_u16(length); - } else { - buf.put_u16(0); - buf.put_u32(length); - } - } + write_size(self, buf); self.target.write_to(buf)?; self.graphics_context.write_to(buf)?; diff --git a/xrbk_macro/src/definition/expansion/writable.rs b/xrbk_macro/src/definition/expansion/writable.rs index fdf7f30a..ef62584b 100644 --- a/xrbk_macro/src/definition/expansion/writable.rs +++ b/xrbk_macro/src/definition/expansion/writable.rs @@ -145,21 +145,22 @@ impl Request { #[cfg(feature = "big-requests")] { let length = ::length(&self); - // If it can fit into a u16, then we don't need the extended length field - if let Ok(length) = length.try_into() { - <_ as ::xrbk::BufMut>::put_u16( + match u16::try_from(length) { + Ok(length) => <_ as ::xrbk::BufMut>::put_u16( buf, - length, - ); - } else { - <_ as ::xrbk::BufMut>::put_u16( - buf, - 0, - ); - <_ as ::xrbk::BufMut>::put_u32( - buf, - length, - ); + length + ), + // length is too big for u16, using the extended length field + Err(_) => { + <_ as ::xrbk::BufMut>::put_u16( + buf, + 0, + ); + <_ as ::xrbk::BufMut>::put_u32( + buf, + length, + ); + }, } } From f0fadabf1f81f71135cac662755ab84fb17121c8 Mon Sep 17 00:00:00 2001 From: Syudagye Date: Sun, 5 Mar 2023 21:42:21 +0100 Subject: [PATCH 6/9] Documented `big_requests` extension --- src/big_requests.rs | 8 +++++++- src/big_requests/reply.rs | 29 +++++++++++++++++++++++++++++ src/big_requests/request.rs | 19 +++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/src/big_requests.rs b/src/big_requests.rs index b74d80cb..7d3d2eac 100644 --- a/src/big_requests.rs +++ b/src/big_requests.rs @@ -2,7 +2,13 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -//! Request to enable extended length field in the protocol. +//! Messages defined in the [Big Requests extension]. +//! +//! The [Big Requests extension] enables extended length field for large requests. +//! +//! [Requests]: crate::message::Request +//! [Replies]: crate::message::Reply +//! [Big Requests extension]: https://www.x.org/releases/X11R7.7/doc/bigreqsproto/bigreq.html pub mod reply; pub mod request; diff --git a/src/big_requests/reply.rs b/src/big_requests/reply.rs index ca0f7f4a..ff03e5a5 100644 --- a/src/big_requests/reply.rs +++ b/src/big_requests/reply.rs @@ -2,6 +2,15 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. +//! [Replies] defined in the [Big Requests extension]. +//! +//! [Replies] are messages sent from the X server to an X client in response to +//! a [request]. +//! +//! [Replies]: crate::message::Reply +//! [request]: crate::message::Request +//! [Big Requests extension]: super + extern crate self as xrb; use crate::{big_requests::request, message::Reply}; @@ -9,13 +18,33 @@ use derivative::Derivative; use xrbk_macro::derive_xrb; derive_xrb! { + /// The [reply] to a [`EnableBigRequests` request]. + /// + /// [reply]: Reply + /// + /// [`EnableBigRequests` request]: request::EnableBigRequests #[derive(Derivative, Debug, X11Size, Readable, Writable)] #[derivative(Hash, PartialEq, Eq)] pub struct EnableBigRequests: Reply for request::EnableBigRequests { + /// The sequence number identifying the [request] that generated this + /// [reply]. + /// + /// See [`Reply::sequence`] for more information. + /// + /// [request]: crate::message::Request + /// [reply]: Reply + /// + /// [`Reply::sequence`]: Reply #[sequence] #[derivative(Hash = "ignore", PartialEq = "ignore")] pub sequence: u16, + /// The new maximum length for a [request]. + /// + /// This value will always be greater than the one returned in [initial setup]. + /// + /// [initial setup]: crate::connection + /// [request]: crate::message::Request pub maximum_request_length: u32, [_; 2], } diff --git a/src/big_requests/request.rs b/src/big_requests/request.rs index c6d76eb1..f734b3ba 100644 --- a/src/big_requests/request.rs +++ b/src/big_requests/request.rs @@ -2,6 +2,13 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. +//! [Requests] defined in the [Big Requests extension]. +//! +//! [Requests] are messages sent from an X client to the X server. +//! +//! [Requests]: crate::message::Request +//! [Big Requests extension]: super + extern crate self as xrb; use crate::{big_requests::reply, message::Request}; @@ -9,6 +16,18 @@ use derivative::Derivative; use xrbk_macro::derive_xrb; derive_xrb! { + /// A [request] that enables extended-length protocol requests for the requesting client. + /// + /// # Replies + /// This [request] generates a [`EnableBigRequests` reply]. + /// + /// # Events and Errors + /// This request does not generate any [Events] or [Errors]. + /// + /// [request]: Request + /// [Events]: crate::message::Event + /// [Errors]: crate::message::Error + /// [`EnableBigRequests` reply]: reply::EnableBigRequests #[derive(Derivative, Debug, X11Size, Readable, Writable)] #[derivative(Hash, PartialEq, Eq)] pub struct EnableBigRequests: Request(0 /* TODO: extensions use dynamic major opcodes */) -> reply::EnableBigRequests {} From 4a6b18b2823da05eb07ec914c5c2b4f7520ac1ea Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 5 Mar 2023 20:47:38 +0000 Subject: [PATCH 7/9] [CI984] formatted code with rustfmt --- src/big_requests.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/big_requests.rs b/src/big_requests.rs index 7d3d2eac..b0ff6e8b 100644 --- a/src/big_requests.rs +++ b/src/big_requests.rs @@ -4,7 +4,8 @@ //! Messages defined in the [Big Requests extension]. //! -//! The [Big Requests extension] enables extended length field for large requests. +//! The [Big Requests extension] enables extended length field for large +//! requests. //! //! [Requests]: crate::message::Request //! [Replies]: crate::message::Reply From 6831e73ed81c6cc2afed9fd6b7a3fdedb6a11ef0 Mon Sep 17 00:00:00 2001 From: Syudagye Date: Fri, 10 Mar 2023 10:30:00 +0100 Subject: [PATCH 8/9] Added `EXTENSION_NAME` constant --- src/big_requests.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/big_requests.rs b/src/big_requests.rs index b0ff6e8b..2b9654d5 100644 --- a/src/big_requests.rs +++ b/src/big_requests.rs @@ -11,5 +11,9 @@ //! [Replies]: crate::message::Reply //! [Big Requests extension]: https://www.x.org/releases/X11R7.7/doc/bigreqsproto/bigreq.html +/// This extension's internal name. +/// This is used to retrieve the major opcode for this extension. +pub const EXTENSION_NAME: &'static str = "BIG-REQUESTS"; + pub mod reply; pub mod request; From 65c81cc8b475aebb3f2ac8afb15fad8bcf50f6c4 Mon Sep 17 00:00:00 2001 From: Syudagye Date: Tue, 14 Mar 2023 22:20:04 +0100 Subject: [PATCH 9/9] Fixed clippy error --- src/big_requests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/big_requests.rs b/src/big_requests.rs index 2b9654d5..739328a1 100644 --- a/src/big_requests.rs +++ b/src/big_requests.rs @@ -13,7 +13,7 @@ /// This extension's internal name. /// This is used to retrieve the major opcode for this extension. -pub const EXTENSION_NAME: &'static str = "BIG-REQUESTS"; +pub const EXTENSION_NAME: &str = "BIG-REQUESTS"; pub mod reply; pub mod request;