dioxus_provider/
types.rs

1//! Common types and aliases used throughout dioxus-provider
2
3use std::{
4    collections::{HashMap, HashSet},
5    sync::{Arc, Mutex},
6    time::Duration,
7};
8
9/// Type alias for reactive context storage
10pub type ReactiveContextSet = Arc<Mutex<HashSet<ReactiveContext>>>;
11
12/// Type alias for reactive context registry
13pub type ReactiveContextRegistry = Arc<Mutex<HashMap<String, ReactiveContextSet>>>;
14
15/// Type alias for interval task registry
16/// Since we're using dioxus spawn for both platforms, we only store interval duration
17pub type IntervalTaskRegistry = Arc<Mutex<HashMap<String, (Duration, ())>>>;
18
19/// Represents a reactive context that can be marked as dirty when providers update
20#[derive(Debug, Clone, Hash, PartialEq, Eq)]
21pub struct ReactiveContext {
22    pub id: String,
23}
24
25impl ReactiveContext {
26    pub fn new(id: String) -> Self {
27        Self { id }
28    }
29}