|
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])*
|
@@ -172,6 +195,17 @@ macro_rules! make_dispatch {
|
172 | 195 | }
|
173 | 196 | }
|
174 | 197 | }
|
| 198 | + |
| 199 | + impl<D: fmt::Debug, W: fmt::Debug> fmt::Debug for BufferDispatch<'_, D, W> { |
| 200 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 201 | + match self { |
| 202 | + $( |
| 203 | + $(#[$attr])* |
| 204 | + Self::$name(inner) => inner.fmt(f), |
| 205 | + )* |
| 206 | + } |
| 207 | + } |
| 208 | + } |
175 | 209 | };
|
176 | 210 | }
|
177 | 211 |
|
|
0 commit comments