feat(input): retained mode capture system

This commit is contained in:
Nova
2025-04-07 08:41:48 -07:00
committed by Nova
parent a149098044
commit fe9ae8225c
5 changed files with 43 additions and 16 deletions

View File

@@ -103,6 +103,16 @@ impl<T: Send + Sync + ?Sized> Default for Registry<T> {
}
}
impl<T: Send + Sync + Sized> FromIterator<Arc<T>> for Registry<T> {
fn from_iter<I: IntoIterator<Item = Arc<T>>>(iter: I) -> Self {
Registry(MaybeLazy::NonLazy(
iter.into_iter()
.map(|i| (Arc::as_ptr(&i) as usize, Arc::downgrade(&i)))
.collect(),
))
}
}
#[derive(Debug)]
enum MaybeLazy<T> {
Lazy(LazyLock<T>),