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)]
25#[non_exhaustive]
26pub enum RenderError {
27 MissingAesthetic(String),
28 BackendError(String),
29 IoError(std::io::Error),
30}
31
32impl std::fmt::Display for RenderError {
33 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
34 match self {
35 RenderError::MissingAesthetic(a) => write!(f, "Missing required aesthetic: {a}"),
36 RenderError::BackendError(e) => write!(f, "Backend error: {e}"),
37 RenderError::IoError(e) => write!(f, "IO error: {e}"),
38 }
39 }
40}
41
42impl std::error::Error for RenderError {}
43
44impl From<std::io::Error> for RenderError {
45 fn from(e: std::io::Error) -> Self {
46 RenderError::IoError(e)
47 }
48}