use default_struct_builder::DefaultBuilder;
use std::rc::Rc;
#[derive(DefaultBuilder)]
pub struct UseTimestampOptions {
pub(crate) offset: f64,
pub(crate) immediate: bool,
#[builder(into)]
pub(crate) interval: TimestampInterval,
pub(crate) callback: Rc<dyn Fn(f64)>,
}
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
pub enum TimestampInterval {
RequestAnimationFrame,
Interval(u64),
}
impl From<u64> for TimestampInterval {
fn from(value: u64) -> Self {
Self::Interval(value)
}
}
impl Default for UseTimestampOptions {
fn default() -> Self {
Self {
offset: 0.0,
immediate: true,
interval: TimestampInterval::RequestAnimationFrame,
callback: Rc::new(|_| {}),
}
}
}