erase the original readable type
This commit is contained in:
1 parent
c8937cb4df
commit
8689509eb5
9 files changed
+99
-175
No files matched your search
@@ -1,4 +1,4 @@
|
||||
use crate::{read::Readable, Signal, SignalData};
|
||||
use crate::{read::Readable, ReadableRef, Signal, SignalData};
|
||||
use std::ops::Deref;
|
||||
|
||||
use dioxus_core::{prelude::IntoAttributeValue, ScopeId};
|
||||
@@ -56,24 +56,10 @@ impl<T: 'static, S: Storage<SignalData<T>>> ReadOnlySignal<T, S> {
|
||||
|
||||
impl<T, S: Storage<SignalData<T>>> Readable for ReadOnlySignal<T, S> {
|
||||
type Target = T;
|
||||
type Ref<R: ?Sized + 'static> = S::Ref<R>;
|
||||
|
||||
fn map_ref<I: ?Sized, U: ?Sized, F: FnOnce(&I) -> &U>(
|
||||
ref_: Self::Ref<I>,
|
||||
f: F,
|
||||
) -> Self::Ref<U> {
|
||||
S::map(ref_, f)
|
||||
}
|
||||
|
||||
fn try_map_ref<I: ?Sized, U: ?Sized, F: FnOnce(&I) -> Option<&U>>(
|
||||
ref_: Self::Ref<I>,
|
||||
f: F,
|
||||
) -> Option<Self::Ref<U>> {
|
||||
S::try_map(ref_, f)
|
||||
}
|
||||
type Storage = S;
|
||||
|
||||
#[track_caller]
|
||||
fn try_read(&self) -> Result<Self::Ref<T>, generational_box::BorrowError> {
|
||||
fn try_read(&self) -> Result<ReadableRef<Self>, generational_box::BorrowError> {
|
||||
self.inner.try_read()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user