pub enum AnimationError {
InvalidDuration,
AnimationNotFound,
SchedulerFull,
InterpolationError,
InvalidState,
}Expand description
Error type for animation operations.
This error type is only available when the “animations” feature is enabled. It covers all animation-related operations including animation scheduling, interpolation, and state management.
§Common Scenarios
- Invalid animation duration
- Animation scheduler at capacity
- Interpolation failures
- Invalid animation state transitions
§Examples
use embedded_charts::prelude::*;
use embedded_charts::error::AnimationError;
// Example function that might return an AnimationError
fn start_animation() -> Result<u32, AnimationError> {
// This would be actual animation logic
Err(AnimationError::InvalidDuration)
}
match start_animation() {
Ok(animation_id) => println!("Animation started: {}", animation_id),
Err(AnimationError::InvalidDuration) => println!("Duration must be positive"),
Err(AnimationError::SchedulerFull) => println!("Too many active animations"),
Err(e) => println!("Animation error: {}", e),
}Variants§
InvalidDuration
Invalid duration specified.
Occurs when animation duration is zero, negative, or exceeds maximum allowed duration.
AnimationNotFound
Animation with specified ID was not found.
Returned when trying to access or modify an animation that doesn’t exist or has already completed.
SchedulerFull
Animation scheduler is full.
Occurs when trying to start a new animation but the scheduler has reached its maximum capacity.
InterpolationError
Error occurred during interpolation.
Returned when interpolation between animation keyframes fails, typically due to incompatible data types or invalid values.
InvalidState
Animation state is invalid.
Occurs when an animation operation is attempted on an animation in an inappropriate state (e.g., trying to pause a completed animation).
Trait Implementations§
Source§impl Clone for AnimationError
impl Clone for AnimationError
Source§fn clone(&self) -> AnimationError
fn clone(&self) -> AnimationError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AnimationError
impl Debug for AnimationError
Source§impl Display for AnimationError
Available on crate feature animations only.
impl Display for AnimationError
animations only.Source§impl Error for AnimationError
Available on crate features animations and std only.
impl Error for AnimationError
animations and std only.1.30.0 · 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.