pub enum ChartError {
InsufficientData,
InvalidRange,
InvalidData,
MemoryFull,
RenderingError,
InvalidConfiguration,
ConfigurationError,
RenderError(RenderError),
LayoutError(LayoutError),
DataError(DataError),
AnimationError(AnimationError),
}Expand description
Main error type for chart operations.
This is the primary error type returned by most chart operations. It encompasses all possible error conditions that can occur during chart creation, configuration, and rendering.
§Error Variants
- Data-related errors: Issues with data series, points, or bounds
- Rendering errors: Problems during drawing operations
- Configuration errors: Invalid chart or component configuration
- Memory errors: Buffer overflow or allocation failures
- Animation errors: Issues with animation system (feature-gated)
§Examples
use embedded_charts::prelude::*;
use embedded_charts::error::ChartError;
// Example function that might return a ChartError
fn render_chart() -> Result<(), ChartError> {
// This would be actual chart rendering logic
Err(ChartError::InsufficientData)
}
match render_chart() {
Ok(()) => println!("Chart rendered successfully"),
Err(ChartError::InsufficientData) => println!("Not enough data to render"),
Err(ChartError::MemoryFull) => println!("Out of memory"),
Err(e) => println!("Other error: {}", e),
}Variants§
InsufficientData
Insufficient data to render the chart.
This error occurs when a chart requires a minimum number of data points but the provided data series doesn’t meet that requirement.
InvalidRange
Invalid range specified for axis or data.
Returned when axis ranges are invalid (e.g., min > max) or when data values fall outside expected ranges.
InvalidData
Invalid data provided.
Generic error for data that doesn’t meet the chart’s requirements, such as NaN values, infinite values, or malformed data points.
MemoryFull
Memory allocation failed or buffer is full.
Occurs when static buffers reach capacity or when memory allocation
fails in std environments.
RenderingError
Error occurred during rendering.
Generic rendering error for issues during the drawing process.
InvalidConfiguration
Invalid configuration provided.
Returned when chart configuration contains invalid or conflicting settings.
ConfigurationError
Configuration error occurred.
More specific configuration error, typically with additional context.
RenderError(RenderError)
Render error occurred.
Specific rendering error with detailed error information.
LayoutError(LayoutError)
Layout error occurred.
Error during chart layout calculation or component positioning.
DataError(DataError)
Data error occurred.
Specific data-related error with detailed error information.
AnimationError(AnimationError)
Animation error occurred.
Error in the animation system (only available with “animations” feature).
Trait Implementations§
Source§impl Clone for ChartError
impl Clone for ChartError
Source§fn clone(&self) -> ChartError
fn clone(&self) -> ChartError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChartError
impl Debug for ChartError
Source§impl Display for ChartError
impl Display for ChartError
Source§impl Error for ChartError
Available on crate feature std only.
impl Error for ChartError
std only.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
Source§impl From<AnimationError> for ChartError
Available on crate feature animations only.
impl From<AnimationError> for ChartError
animations only.