space: Make `RenderError` require Debug

This commit is contained in:
Victor Brekenfeld 2022-01-05 21:06:59 +01:00
parent 8059bdc5db
commit 58f20fb6c7
1 changed files with 12 additions and 2 deletions

View File

@ -18,7 +18,7 @@ use crate::{
},
};
use indexmap::{IndexMap, IndexSet};
use std::{cell::RefCell, collections::VecDeque};
use std::{cell::RefCell, collections::VecDeque, fmt};
use wayland_server::protocol::wl_surface::WlSurface;
mod element;
@ -682,7 +682,7 @@ impl Space {
}
/// Errors thrown by [`Space::render_output`]
#[derive(Debug, thiserror::Error)]
#[derive(thiserror::Error)]
pub enum RenderError<R: Renderer> {
/// The provided [`Renderer`] did return an error during an operation
#[error(transparent)]
@ -694,3 +694,13 @@ pub enum RenderError<R: Renderer> {
#[error("Output was not mapped to this space")]
UnmappedOutput,
}
impl<R: Renderer> fmt::Debug for RenderError<R> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
RenderError::Rendering(err) => fmt::Debug::fmt(err, f),
RenderError::OutputNoMode => f.write_str("Output has no active move"),
RenderError::UnmappedOutput => f.write_str("Output was not mapped to this space"),
}
}
}