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