make mapped signal readable

This commit is contained in:
Evan Almloff committed 2024-02-07 09:35:06 -06:00
1 parent 1af8f56e89
commit c8937cb4df
8 files changed
+176 -126

No files matched your search

+3 -12
View File
@@ -2,11 +2,11 @@ use crate::read::Readable;
use crate::write::Writable;
use crate::Write;
use dioxus_core::prelude::{IntoAttributeValue, ScopeId};
use generational_box::{AnyStorage, GenerationalRef, UnsyncStorage};
use std::{cell::Ref, mem::MaybeUninit, ops::Deref};
use generational_box::{AnyStorage, UnsyncStorage};
use std::{mem::MaybeUninit, ops::Deref};
use super::get_global_context;
use crate::{MappedSignal, Signal};
use crate::Signal;
/// A signal that can be accessed from anywhere in the application and created in a static
pub struct GlobalSignal<T> {
@@ -60,15 +60,6 @@ impl<T: 'static> GlobalSignal<T> {
self.signal().with_mut(f)
}
/// Map the signal to a new type.
pub fn map<O>(
&self,
f: impl Fn(&T) -> &O + 'static,
) -> MappedSignal<GenerationalRef<Ref<'static, O>>> {
// MappedSignal::new(self.signal(), f)
todo!()
}
/// Get the generational id of the signal.
pub fn id(&self) -> generational_box::GenerationalBoxId {
self.signal().id()