1pub mod backend;
2pub mod corner_layout;
3pub mod layout;
4#[cfg(feature = "canvas")]
6pub mod pixel_backend;
7#[cfg(all(feature = "plotters", not(target_arch = "wasm32")))]
10pub mod plotters_backend;
11pub mod renderer;
12pub mod svg_backend;
13pub mod text;
14
15#[derive(Clone, Debug)]
17pub struct Rect {
18 pub x: f64,
19 pub y: f64,
20 pub width: f64,
21 pub height: f64,
22}
23
24#[derive(Debug)]
26#[non_exhaustive]
27pub enum RenderError {
28 MissingAesthetic(String),
29 BackendError(String),
30 IoError(std::io::Error),
31}
32
33impl std::fmt::Display for RenderError {
34 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35 match self {
36 RenderError::MissingAesthetic(a) => write!(f, "Missing required aesthetic: {a}"),
37 RenderError::BackendError(e) => write!(f, "Backend error: {e}"),
38 RenderError::IoError(e) => write!(f, "IO error: {e}"),
39 }
40 }
41}
42
43impl std::error::Error for RenderError {}
44
45impl From<std::io::Error> for RenderError {
46 fn from(e: std::io::Error) -> Self {
47 RenderError::IoError(e)
48 }
49}