DotmaxError

Enum DotmaxError 

Source
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,000
  • height > 0 && height <= 10,000

Fields

§width: usize

The invalid width value

§height: usize

The invalid height value

§

OutOfBounds

Coordinate access is outside grid boundaries

Valid coordinates must satisfy:

  • x < width
  • y < height

Fields

§x: usize

The X coordinate that was out of bounds

§y: usize

The Y coordinate that was out of bounds

§width: usize

The grid width

§height: usize

The grid height

§

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 7

Fields

§index: u8

The invalid dot index (must be 0-7)

§

Terminal(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.

Fields

§x: usize

The X coordinate of the cell

§y: usize

The Y coordinate of the cell

§

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.

Fields

§thickness: u32

The invalid thickness value

§

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.

Fields

§reason: String

The reason the polygon is invalid

§

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.

Fields

§count: usize

The number of characters in the set

§

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

§expected: usize

Expected buffer size (grid width × height)

§actual: usize

Actual buffer size provided

§

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 svg feature)
  • Animated: GIF (multi-frame), APNG
  • Video: MP4, MKV, AVI, WebM (requires video feature)

Fields

§format: String

Description of the detected or unknown format

Trait Implementations§

Source§

impl Debug for DotmaxError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for DotmaxError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for DotmaxError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for DotmaxError

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> ToCompactString for T
where T: Display,

Source§

impl<T> ToLine for T
where T: Display,

Source§

fn to_line(&self) -> Line<'_>

Converts the value to a Line.
Source§

impl<T> ToSpan for T
where T: Display,

Source§

fn to_span(&self) -> Span<'_>

Converts the value to a Span.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToText for T
where T: Display,

Source§

fn to_text(&self) -> Text<'_>

Converts the value to a Text.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more