aura_anim_iced/state/
transition.rs1use std::sync::Arc;
2
3use crate::Timeline;
4
5#[derive(Debug, Clone, PartialEq)]
7pub struct StateTransition<S>
8where
9 S: Copy + Eq,
10{
11 from: S,
12 to: S,
13 timeline: Arc<Timeline>,
14}
15
16impl<S> StateTransition<S>
17where
18 S: Copy + Eq,
19{
20 #[must_use]
22 pub fn new(from: S, to: S, timeline: Timeline) -> Self {
23 Self {
24 from,
25 to,
26 timeline: Arc::new(timeline),
27 }
28 }
29
30 #[must_use]
32 pub const fn from(&self) -> S {
33 self.from
34 }
35
36 #[must_use]
38 pub const fn to(&self) -> S {
39 self.to
40 }
41
42 #[must_use]
44 pub fn timeline(&self) -> &Timeline {
45 &self.timeline
46 }
47
48 pub(crate) fn timeline_arc(&self) -> Arc<Timeline> {
49 Arc::clone(&self.timeline)
50 }
51}