|
3 | 3 | use crate::{backend_interface::*, backends, InitError, Rect, SoftBufferError}; |
4 | 4 |
|
5 | 5 | use raw_window_handle::{HasDisplayHandle, HasWindowHandle}; |
| 6 | +use std::fmt; |
6 | 7 | use std::num::NonZeroU32; |
7 | 8 | #[cfg(any(wayland_platform, x11_platform, kms_platform))] |
8 | 9 | use std::sync::Arc; |
@@ -56,6 +57,17 @@ macro_rules! make_dispatch { |
56 | 57 | } |
57 | 58 | } |
58 | 59 |
|
| 60 | + impl<D: fmt::Debug> fmt::Debug for ContextDispatch<D> { |
| 61 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 62 | + match self { |
| 63 | + $( |
| 64 | + $(#[$attr])* |
| 65 | + Self::$name(inner) => inner.fmt(f), |
| 66 | + )* |
| 67 | + } |
| 68 | + } |
| 69 | + } |
| 70 | + |
59 | 71 | #[allow(clippy::large_enum_variant)] // it's boxed anyways |
60 | 72 | pub(crate) enum SurfaceDispatch<$dgen, $wgen> { |
61 | 73 | $( |
@@ -117,6 +129,17 @@ macro_rules! make_dispatch { |
117 | 129 | } |
118 | 130 | } |
119 | 131 |
|
| 132 | + impl<D: fmt::Debug, W: fmt::Debug> fmt::Debug for SurfaceDispatch<D, W> { |
| 133 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 134 | + match self { |
| 135 | + $( |
| 136 | + $(#[$attr])* |
| 137 | + Self::$name(inner) => inner.fmt(f), |
| 138 | + )* |
| 139 | + } |
| 140 | + } |
| 141 | + } |
| 142 | + |
120 | 143 | pub(crate) enum BufferDispatch<'a, $dgen, $wgen> { |
121 | 144 | $( |
122 | 145 | $(#[$attr])* |
@@ -192,6 +215,17 @@ macro_rules! make_dispatch { |
192 | 215 | } |
193 | 216 | } |
194 | 217 | } |
| 218 | + |
| 219 | + impl<D: fmt::Debug, W: fmt::Debug> fmt::Debug for BufferDispatch<'_, D, W> { |
| 220 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 221 | + match self { |
| 222 | + $( |
| 223 | + $(#[$attr])* |
| 224 | + Self::$name(inner) => inner.fmt(f), |
| 225 | + )* |
| 226 | + } |
| 227 | + } |
| 228 | + } |
195 | 229 | }; |
196 | 230 | } |
197 | 231 |
|
|
0 commit comments