| 57 | } |
| 58 | |
| 59 | fn get_transition(&self, from: Option<&RouteType>, to: Option<&RouteType>) -> Box<dyn Transition> { |
| 60 | match (from, to) { |
| 61 | (Some(from), Some(to)) => { |
| 62 | if let Some(transition) = self.transitions.get(&(from.clone(), to.clone())) { |
| 63 | Box::new(DefaultTransition) // For now, return a new instance since we can't clone trait objects |
| 64 | } else { |
| 65 | Box::new(DefaultTransition) |
| 66 | } |
| 67 | } |
| 68 | _ => Box::new(DefaultTransition), |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | pub fn push(&mut self, route: Route) { |
| 73 | let transition = self.get_transition( |