* Fix #2612: adjust readable trait to allow try_peek Our implementation for Readable was inconsistent. We had a try_unchecked variant for read but not for peek. This resolves that by making a breaking change to the Readable interface. * fix doctests too
This commit is contained in:
1 parent
443b9a4af6
commit
e42b71b1ba
13 files changed
+102
-58
No files matched your search
@@ -1,5 +1,5 @@
|
||||
use generational_box::GenerationalBoxId;
|
||||
use generational_box::UnsyncStorage;
|
||||
use generational_box::{BorrowResult, GenerationalBoxId};
|
||||
use std::ops::Deref;
|
||||
|
||||
use dioxus_core::prelude::*;
|
||||
@@ -129,8 +129,8 @@ impl<T: 'static, S: Storage<T>> Readable for CopyValue<T, S> {
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn peek_unchecked(&self) -> ReadableRef<'static, Self> {
|
||||
self.value.read()
|
||||
fn try_peek_unchecked(&self) -> BorrowResult<ReadableRef<'static, Self>> {
|
||||
self.value.try_read()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user