use core::ops::{Deref, Sub}; extern crate alloc; use alloc::boxed::Box; use crate::{Anim, Fun}; pub type AnimBox = Anim>>; impl Anim where F: Fun + 'static, { /// Returns a boxed version of this animation. /// /// This may be used to reduce the compilation time of deeply nested /// animations. pub fn into_box(self) -> AnimBox { Anim(Box::new(self.0)) } pub fn into_box_fn(self) -> Box F::V> { Box::new(self.into_fn()) } } // TODO: We need to get rid of the 'static requirements. impl Anim where F: Fun + 'static, F::T: Copy + PartialOrd + Sub + 'static, F::V: 'static, { pub fn seq_box(self, self_end: F::T, next: A) -> AnimBox where G: Fun + 'static, A: Into>, { self.into_box() .seq(self_end, next.into().into_box()) .into_box() } } impl<'a, T, V> Fun for Box> { type T = T; type V = V; fn eval(&self, t: Self::T) -> Self::V { self.deref().eval(t) } }