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