pub enum DotmaxError {
Show 15 variants
InvalidDimensions {
width: usize,
height: usize,
},
OutOfBounds {
x: usize,
y: usize,
width: usize,
height: usize,
},
InvalidDotIndex {
index: u8,
},
Terminal(Error),
TerminalBackend(String),
UnicodeConversion {
x: usize,
y: usize,
},
InvalidThickness {
thickness: u32,
},
InvalidPolygon {
reason: String,
},
EmptyDensitySet,
TooManyCharacters {
count: usize,
},
BufferSizeMismatch {
expected: usize,
actual: usize,
},
EmptyColorScheme,
InvalidColorScheme(String),
InvalidIntensity(f32),
FormatError {
format: String,
},
}Expand description
Comprehensive error type for all dotmax operations
All variants include contextual information to aid debugging and provide actionable error messages to end users.
Variants§
InvalidDimensions
Grid dimensions are invalid (zero or exceeding maximum limits)
Valid dimensions must satisfy:
width > 0 && width <= 10,000height > 0 && height <= 10,000
OutOfBounds
Coordinate access is outside grid boundaries
Valid coordinates must satisfy:
x < widthy < height
Fields
InvalidDotIndex
Dot index is invalid (must be 0-7 for 2×4 braille cells)
Valid dot indices:
0 3 (positions in braille cell)
1 4
2 5
6 7Terminal(Error)
Terminal I/O error from underlying terminal backend
This wraps std::io::Error using #[from] to preserve the error source
chain for proper debugging and error context propagation.
TerminalBackend(String)
Terminal backend operation failed
Used for terminal-specific errors that don’t map to standard I/O errors (e.g., capability detection failures, initialization errors).
UnicodeConversion
Unicode braille character conversion failed
This should rarely occur as braille Unicode range (U+2800–U+28FF) is well-defined, but may happen if cell data becomes corrupted.
InvalidThickness
Invalid line thickness (must be ≥ 1)
This error is returned when attempting to draw a line with thickness=0. Valid thickness values must be at least 1. For braille resolution, recommended maximum is 10 dots.
InvalidPolygon
Invalid polygon definition
This error is returned when attempting to draw a polygon with invalid parameters (e.g., fewer than 3 vertices, empty vertex list). Polygons require at least 3 vertices to form a closed shape.
EmptyDensitySet
Density set cannot be empty
This error is returned when attempting to create a DensitySet with an
empty character list. A valid density set must contain at least one
character for intensity mapping.
TooManyCharacters
Density set has too many characters (max 256)
This error is returned when attempting to create a DensitySet with more
than 256 characters. The limit ensures reasonable memory usage and
mapping performance.
BufferSizeMismatch
Intensity buffer size mismatch with grid dimensions
This error is returned when the intensity buffer length does not match the expected grid size (width × height). All intensity buffers must have exactly one f32 value per grid cell.
Fields
EmptyColorScheme
Color scheme cannot have an empty color list
This error is returned when attempting to create a ColorScheme with an
empty color vector. A valid color scheme must contain at least one color
stop for intensity mapping.
InvalidColorScheme(String)
Invalid color scheme configuration
This error is returned when attempting to build a ColorScheme with an
invalid configuration. Common causes include:
- Fewer than 2 color stops defined
- Duplicate intensity values at the same position
The error message provides specific details about the validation failure.
InvalidIntensity(f32)
Invalid intensity value for color scheme
This error is returned when a color stop’s intensity value is outside the valid range of 0.0 to 1.0 (inclusive).
Valid intensity values must satisfy: 0.0 <= intensity <= 1.0
FormatError
Unsupported or unknown media format
This error is returned when attempting to display or load a file with an unsupported or unrecognized format. The format detection system could not identify the file type from magic bytes or extension.
Supported formats include:
- Static images: PNG, JPEG, GIF (single frame), BMP, WebP, TIFF
- Vector graphics: SVG (requires
svgfeature) - Animated: GIF (multi-frame), APNG
- Video: MP4, MKV, AVI, WebM (requires
videofeature)
Trait Implementations§
Source§impl Debug for DotmaxError
impl Debug for DotmaxError
Source§impl Display for DotmaxError
impl Display for DotmaxError
Source§impl Error for DotmaxError
impl Error for DotmaxError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations§
impl Freeze for DotmaxError
impl !RefUnwindSafe for DotmaxError
impl Send for DotmaxError
impl Sync for DotmaxError
impl Unpin for DotmaxError
impl !UnwindSafe for DotmaxError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more