use std::sync::Arc;
use crate::Timeline;
#[derive(Debug, Clone, PartialEq)]
pub struct StateTransition<S>
where
S: Copy + Eq,
{
from: S,
to: S,
timeline: Arc<Timeline>,
}
impl<S> StateTransition<S>
where
S: Copy + Eq,
{
#[must_use]
pub fn new(from: S, to: S, timeline: Timeline) -> Self {
Self {
from,
to,
timeline: Arc::new(timeline),
}
}
#[must_use]
pub const fn from(&self) -> S {
self.from
}
#[must_use]
pub const fn to(&self) -> S {
self.to
}
#[must_use]
pub fn timeline(&self) -> &Timeline {
&self.timeline
}
pub(crate) fn timeline_arc(&self) -> Arc<Timeline> {
Arc::clone(&self.timeline)
}
}