Skip to main content

tellers_timeline_core/
validate.rs

1use thiserror::Error;
2
3use crate::Timeline;
4
5#[derive(Debug, Error)]
6pub enum ValidationError {
7    #[error("negative duration for an item")]
8    NegativeDuration,
9}
10
11pub fn validate_timeline(tl: &Timeline) -> Vec<ValidationError> {
12    let mut errors = Vec::new();
13
14    for track in &tl.tracks.children {
15        for item in &track.items {
16            if item.duration() < 0.0 {
17                errors.push(ValidationError::NegativeDuration);
18            }
19        }
20    }
21
22    errors
23}