From 5a958d9496d5adcf1bc0a7880da365853e414d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20S=C3=A1nchez=20Mu=C3=B1oz?= Date: Sun, 26 Nov 2023 16:07:23 +0100 Subject: [PATCH] Update some dependencies --- extract-generated-code-doc/Cargo.toml | 2 +- generator/Cargo.toml | 4 ++-- x11rb/Cargo.toml | 2 +- x11rb/examples/xclock_utc.rs | 11 ++++++++--- xcbgen-rs/Cargo.toml | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/extract-generated-code-doc/Cargo.toml b/extract-generated-code-doc/Cargo.toml index 0c9f32d4..8d182f77 100644 --- a/extract-generated-code-doc/Cargo.toml +++ b/extract-generated-code-doc/Cargo.toml @@ -7,4 +7,4 @@ publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -regex = "1.9" +regex = "1.10" diff --git a/generator/Cargo.toml b/generator/Cargo.toml index 494cd196..fe02df9f 100644 --- a/generator/Cargo.toml +++ b/generator/Cargo.toml @@ -7,6 +7,6 @@ publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -roxmltree = "0.18.0" +roxmltree = "0.19.0" xcbgen = { path = "../xcbgen-rs" } -regex = "1.9" +regex = "1.10" diff --git a/x11rb/Cargo.toml b/x11rb/Cargo.toml index a745cece..dcde8dcb 100644 --- a/x11rb/Cargo.toml +++ b/x11rb/Cargo.toml @@ -28,7 +28,7 @@ gethostname = "0.4" [dev-dependencies] gethostname = "0.4" -polling = "2.8.0" +polling = "3.3.1" tracing-subscriber = "0.3" [features] diff --git a/x11rb/examples/xclock_utc.rs b/x11rb/examples/xclock_utc.rs index 48ac62f0..3d15d5ea 100644 --- a/x11rb/examples/xclock_utc.rs +++ b/x11rb/examples/xclock_utc.rs @@ -1,3 +1,4 @@ +use std::num::NonZeroUsize; use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; use polling::{Event as PollingEvent, Poller}; @@ -173,7 +174,11 @@ fn poll_with_timeout( timeout: Duration, ) -> Result<(), Box> { // Add interest in the connection's stream. - poller.add(conn.stream(), PollingEvent::readable(1))?; + unsafe { + // SAFETY: The guard bellow guarantees that the source will be removed + // from the poller. + poller.add(conn.stream(), PollingEvent::readable(1))?; + } // Remove it if we time out. let _guard = CallOnDrop(|| { @@ -181,14 +186,14 @@ fn poll_with_timeout( }); // Wait for events. - let mut event = Vec::with_capacity(1); + let mut event = polling::Events::with_capacity(NonZeroUsize::new(1).unwrap()); let target = Instant::now() + timeout; loop { let remaining = target.saturating_duration_since(Instant::now()); poller.wait(&mut event, Some(remaining))?; // If we received an event, we're done. - if event.contains(&PollingEvent::readable(1)) { + if event.iter().any(|event| event.readable) { return Ok(()); } diff --git a/xcbgen-rs/Cargo.toml b/xcbgen-rs/Cargo.toml index 05d317f1..f5e6c476 100644 --- a/xcbgen-rs/Cargo.toml +++ b/xcbgen-rs/Cargo.toml @@ -8,4 +8,4 @@ publish = false [dependencies] once_cell = "1.17.0" -roxmltree = "0.18.0" +roxmltree = "0.19.0"