usecrate::reactive::context;/// An effect (like Vue 3's `watchEffect()`).
/// Runs a closure and automatically tracks any signals read inside it.
/// Re-runs whenever a tracked signal changes.
pubstructEffect{effect_id:usize,
}implEffect{/// Create a new effect from the given closure.
pubfnnew<F:Fn()+Clone+'static>(f: F)->Self{let effect_id =context::run_effect(Box::new(f.clone()));// Run immediately to establish dependencies
context::track_effect(effect_id, f);
Effect { effect_id }}/// Get the effect ID.
pubfnid(&self)->usize{self.effect_id
}}/// Create a new effect (convenience function).
pubfneffect<F:Fn()+Clone+'static>(f: F)-> Effect{Effect::new(f)}