1use std::{
2 error::Error,
3 fmt::{self, Display, Formatter},
4};
5
6#[derive(Clone, Copy, Debug, Eq, PartialEq)]
8pub enum PrepareError {
9 AtlasFull,
10}
11
12impl Display for PrepareError {
13 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
14 write!(f, "Prepare error: glyph texture atlas is full")
15 }
16}
17
18impl Error for PrepareError {}
19
20#[derive(Clone, Copy, Debug, Eq, PartialEq)]
22pub enum RenderError {
23 RemovedFromAtlas,
24 ScreenResolutionChanged,
25}
26
27impl Display for RenderError {
28 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
29 match self {
30 RenderError::RemovedFromAtlas => {
31 write!(
32 f,
33 "Render error: glyph no longer exists within the texture atlas"
34 )
35 }
36 RenderError::ScreenResolutionChanged => write!(
37 f,
38 "Render error: screen resolution changed since last `prepare` call"
39 ),
40 }
41 }
42}
43
44impl Error for RenderError {}