leptos_animate 0.1.15

Animation utilities for Leptos. FLIP, in/out transitions, and helpers for custom animations.
use std::rc::Rc;

use leptos::prelude::Track;

#[derive(Clone)]
pub struct Trackable(Rc<dyn Fn()>);

impl Trackable {
    pub fn track(&self) {
        (self.0)();
    }
}

impl<T> From<T> for Trackable
where
    T: Track + 'static,
{
    fn from(value: T) -> Self {
        Self(Rc::new(move || {
            value.track();
        }))
    }
}