use super::*;
#[derive(CustomDebug, Data, New)]
pub(crate) struct SignalInner<T>
where
T: Clone,
{
#[debug(skip)]
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) value: T,
#[debug(skip)]
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) listeners: Vec<(u64, Box<dyn FnMut()>)>,
#[get(pub, type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
#[new(skip)]
pub(crate) next_listener_id: u64,
#[debug(skip)]
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
#[new(skip)]
pub(crate) removed_listener_ids: Vec<u64>,
#[get(pub, type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
#[new(skip)]
pub(crate) notifying: bool,
#[get(pub, type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) alive: bool,
#[debug(skip)]
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
#[new(skip)]
pub(crate) dependents: Vec<usize>,
}
#[derive(CustomDebug, Data, Eq, Hash, New, Ord, PartialEq, PartialOrd)]
pub struct Signal<T>
where
T: Clone + PartialEq + 'static,
{
#[debug(skip)]
#[get(pub, type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) inner: usize,
#[debug(skip)]
#[get(pub, type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) _marker: PhantomData<fn() -> T>,
}
#[derive(CustomDebug, Data, New)]
pub struct SignalCell<T>
where
T: Clone + PartialEq + 'static,
{
#[debug(skip)]
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) inner: UnsafeCell<Option<Signal<T>>>,
}
pub(crate) struct SignalSlab {
pub(crate) entries: Vec<Box<dyn AnySignalInner>>,
}
#[derive(Clone, Copy, CustomDebug, Data, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct FireHandle {
#[get(pub, type(copy))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) inner: usize,
}