From f73348aa58a90270164c7980694c71d68020068e Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Sun, 18 Oct 2026 08:37:51 +0200 Subject: [PATCH] Remove `Device::connection` Removing this accesor will make it possible to convert `Device` to an enum without converting `Connection`. Signed-off-by: Martin Robinson --- src/angle/device.rs | 7 ------- src/base/io_surface/device.rs | 7 ------- src/cgl/device.rs | 7 ------- src/device.rs | 3 --- src/hardware_buffer/device.rs | 7 ------- src/macros.rs | 5 ----- src/mesa_surfaceless/device.rs | 8 -------- src/multi/device.rs | 13 ------------- src/tests.rs | 1 - src/wayland/device.rs | 8 -------- src/wgl/device.rs | 7 ------- src/x11/device.rs | 8 -------- 12 files changed, 81 deletions(-) diff --git a/src/angle/device.rs b/src/angle/device.rs index 2423d9fa..e2da2672 100644 --- a/src/angle/device.rs +++ b/src/angle/device.rs @@ -1,7 +1,6 @@ //! A thread-local handle to the device. use super::adapter::AngleAdapter; -use crate::angle::connection::Connection; use crate::angle::context::{AngleContext, NativeContext}; use crate::angle::surface::{ AngleSurface, AngleSurfaceTexture, SurfaceDataGuard, Synchronization, Win32Objects, @@ -188,12 +187,6 @@ impl Device { } } - /// Returns the display server connection that this device was created with. - #[inline] - pub fn connection(&self) -> Connection { - Connection - } - /// Returns the adapter that this device was created with. pub fn adapter(&self) -> Adapter { unsafe { diff --git a/src/base/io_surface/device.rs b/src/base/io_surface/device.rs index dc177df0..f9220c75 100644 --- a/src/base/io_surface/device.rs +++ b/src/base/io_surface/device.rs @@ -1,7 +1,6 @@ //! A handle to the device. (This is a no-op, because handles are implicit in `IOSurface`.) use super::adapter::AppleAdapter; -use super::connection::Connection; use crate::Error; use objc2::{rc::Retained, runtime::ProtocolObject}; @@ -40,12 +39,6 @@ impl Device { ) } - /// Returns the display server connection that this device was created with. - #[inline] - pub fn connection(&self) -> Connection { - Connection - } - /// Returns the adapter that this device was created with. #[inline] pub fn adapter(&self) -> AppleAdapter { diff --git a/src/cgl/device.rs b/src/cgl/device.rs index 219dcf31..636885ef 100644 --- a/src/cgl/device.rs +++ b/src/cgl/device.rs @@ -1,6 +1,5 @@ //! A handle to the device. (This is a no-op, because handles are implicit in Apple's Core OpenGL.) -use super::connection::Connection; use super::context::{CglContext, CglContextDescriptor}; use crate::base::io_surface::device::Device as SystemDevice; use crate::cgl::context::{CurrentContextGuard, NativeContext}; @@ -73,12 +72,6 @@ impl Device { self.0.native_device() } - /// Returns the display server connection that this device was created with. - #[inline] - pub fn connection(&self) -> Connection { - Connection(self.0.connection()) - } - /// Returns the adapter that this device was created with. #[inline] pub fn adapter(&self) -> Adapter { diff --git a/src/device.rs b/src/device.rs index 674aee82..2b8b030e 100644 --- a/src/device.rs +++ b/src/device.rs @@ -22,9 +22,6 @@ where // device.rs - /// Returns the display server connection that this device was created with. - fn connection(&self) -> Self::Connection; - /// Returns the adapter that this device was created with. fn adapter(&self) -> Adapter; diff --git a/src/hardware_buffer/device.rs b/src/hardware_buffer/device.rs index c38a1a6d..5555008a 100644 --- a/src/hardware_buffer/device.rs +++ b/src/hardware_buffer/device.rs @@ -1,7 +1,6 @@ //! A thread-local handle to the device. use super::adapter::HardwareBufferAdapter; -use super::connection::Connection; use super::context::{HardwareBufferContext, NativeContext}; use crate::base::egl::context::{self, CurrentContextGuard}; use crate::base::egl::device::EGL_FUNCTIONS; @@ -80,12 +79,6 @@ impl Device { NativeDevice(self.egl_display) } - /// Returns the display server connection that this device was created with. - #[inline] - pub fn connection(&self) -> Connection { - Connection - } - /// Returns the adapter that this device was created with. #[inline] pub fn adapter(&self) -> Adapter { diff --git a/src/macros.rs b/src/macros.rs index cae1e72f..0d267bb2 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -88,11 +88,6 @@ macro_rules! implement_interfaces { // device.rs - #[inline] - fn connection(&self) -> Connection { - Device::connection(self) - } - #[inline] fn adapter(&self) -> Adapter { Device::adapter(self) diff --git a/src/mesa_surfaceless/device.rs b/src/mesa_surfaceless/device.rs index 2f09cec8..941d5e6c 100644 --- a/src/mesa_surfaceless/device.rs +++ b/src/mesa_surfaceless/device.rs @@ -58,14 +58,6 @@ impl Device { } } - /// Returns the display server connection that this device was created with. - #[inline] - pub fn connection(&self) -> Connection { - Connection { - native_connection: self.native_connection.clone(), - } - } - /// Returns the adapter that this device was created with. #[inline] pub fn adapter(&self) -> Adapter { diff --git a/src/multi/device.rs b/src/multi/device.rs index 8f302066..1609a275 100644 --- a/src/multi/device.rs +++ b/src/multi/device.rs @@ -34,14 +34,6 @@ where Def::Connection: ConnectionInterface, Alt::Connection: ConnectionInterface, { - /// Returns the display server connection that this device was created with. - pub fn connection(&self) -> Connection { - match *self { - Device::Default(ref device) => Connection::Default(device.connection()), - Device::Alternate(ref device) => Connection::Alternate(device.connection()), - } - } - /// Returns the adapter that this device was created with. pub fn adapter(&self) -> Adapter { match *self { @@ -70,11 +62,6 @@ where // device.rs - #[inline] - fn connection(&self) -> Connection { - Device::connection(self) - } - #[inline] fn adapter(&self) -> Adapter { Device::adapter(self) diff --git a/src/tests.rs b/src/tests.rs index ba59e8c1..0d872ba2 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -85,7 +85,6 @@ pub fn test_device_accessors() { } Err(err) => panic!("Failed to create device: {:?}", err), }; - drop(device.connection()); drop(device.adapter()); } diff --git a/src/wayland/device.rs b/src/wayland/device.rs index 762a2f95..4138d604 100644 --- a/src/wayland/device.rs +++ b/src/wayland/device.rs @@ -62,14 +62,6 @@ impl Device { } } - /// Returns the display server connection that this device was created with. - #[inline] - pub fn connection(&self) -> Connection { - Connection { - native_connection: self.native_connection.clone(), - } - } - /// Returns the adapter that this device was created with. #[inline] pub fn adapter(&self) -> Adapter { diff --git a/src/wgl/device.rs b/src/wgl/device.rs index 7d32e18f..44992d44 100644 --- a/src/wgl/device.rs +++ b/src/wgl/device.rs @@ -7,7 +7,6 @@ use crate::error::WindowingApiError; use crate::renderbuffers::Renderbuffers; use crate::surface::Framebuffer; use crate::wgl::adapter::WglAdapter; -use crate::wgl::connection::Connection; use crate::wgl::context::{ ContextStatus, CurrentContextGuard, FramebufferGuard, NativeContext, WglContext, WglContextDescriptor, OPENGL_LIBRARY, WGL_EXTENSION_FUNCTIONS, @@ -221,12 +220,6 @@ impl Device { } } - /// Returns the display server connection that this device was created with. - #[inline] - pub fn connection(&self) -> Connection { - Connection - } - /// Returns the adapter that this device was created with. #[inline] pub fn adapter(&self) -> Adapter { diff --git a/src/x11/device.rs b/src/x11/device.rs index 9a71b553..0dcd1fe2 100644 --- a/src/x11/device.rs +++ b/src/x11/device.rs @@ -62,14 +62,6 @@ impl Device { } } - /// Returns the display server connection that this device was created with. - #[inline] - pub fn connection(&self) -> Connection { - Connection { - native_connection: self.native_connection.clone(), - } - } - /// Returns the adapter that this device was created with. #[inline] pub fn adapter(&self) -> Adapter {