use crate::runtime;
#[derive(Debug, Clone, PartialEq)]
pub enum SlideMark {
Break {
at: f64,
},
Notes {
at: f64,
text: String,
},
}
pub fn slide_break() -> std::future::Ready<()> {
runtime::with(|rt| {
let at = rt.task_time.get();
let mut marks = rt.slides.borrow_mut();
let dup = marks.iter().any(
|m| matches!(m, SlideMark::Break { at: t } if (t - at).abs() < crate::TIME_EPSILON),
);
if !dup {
marks.push(SlideMark::Break { at });
}
});
std::future::ready(())
}
pub fn notes(text: impl Into<String>) {
let text = text.into();
runtime::with(|rt| {
let at = rt.task_time.get();
rt.slides.borrow_mut().push(SlideMark::Notes { at, text });
});
}