plotters_bitmap/
error.rs

1#[cfg(all(not(target_arch = "wasm32"), feature = "image"))]
2use image::ImageError;
3
4#[derive(Debug)]
5/// Indicates some error occurs within the bitmap backend
6pub enum BitMapBackendError {
7    /// The buffer provided is invalid, for example, wrong pixel buffer size
8    InvalidBuffer,
9    /// Some IO error occurs while the bitmap manipulation
10    IOError(std::io::Error),
11    #[cfg(all(feature = "gif", not(target_arch = "wasm32"), feature = "image"))]
12    GifEncodingError(gif::EncodingError),
13    #[cfg(all(not(target_arch = "wasm32"), feature = "image"))]
14    /// Image encoding error
15    ImageError(ImageError),
16}
17
18impl std::fmt::Display for BitMapBackendError {
19    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
20        write!(f, "{:?}", self)
21    }
22}
23
24impl std::error::Error for BitMapBackendError {}