Skip to content

Commit 25ddf16

Browse files
authored
Expose safe getters for ComponentRef, closes #402 (#403)
1 parent 15fa92e commit 25ddf16

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

thaw_utils/src/signals/component_ref.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,17 @@ where
4343
self.0.get()
4444
}
4545

46+
pub fn try_get(&self) -> Option<T> {
47+
self.0.try_get().flatten()
48+
}
49+
4650
pub fn get_untracked(&self) -> Option<T> {
4751
self.0.get_untracked()
4852
}
53+
54+
pub fn try_get_untracked(&self) -> Option<T> {
55+
self.0.try_get_untracked().flatten()
56+
}
4957
}
5058

5159
impl<T, S> ComponentRef<T, S>

0 commit comments

Comments
 (0)