use std::time::Duration;
use ff_format::Color;
use crate::ids::MarkerId;
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Marker {
pub id: MarkerId,
pub pts: Duration,
pub name: Option<String>,
pub color: Option<Color>,
pub comment: Option<String>,
}
impl Marker {
#[must_use]
pub fn new(pts: Duration) -> Self {
Self {
id: MarkerId::UNSET,
pts,
name: None,
color: None,
comment: None,
}
}
#[must_use]
pub fn with_name(mut self, name: impl Into<String>) -> Self {
self.name = Some(name.into());
self
}
#[must_use]
pub fn with_color(mut self, color: Color) -> Self {
self.color = Some(color);
self
}
#[must_use]
pub fn with_comment(mut self, comment: impl Into<String>) -> Self {
self.comment = Some(comment.into());
self
}
}