add must use to several hooks
This commit is contained in:
1 parent
04f83e1e92
commit
3bf6d2d7cf
21 files changed
+25
No files matched your search
@@ -28,6 +28,7 @@ impl CallbackApi {
|
||||
}
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn use_atom_context(cx: &ScopeState) -> &CallbackApi {
|
||||
todo!()
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ use std::{
|
||||
///
|
||||
///
|
||||
///
|
||||
#[must_use]
|
||||
pub fn use_atom_ref<'a, T: 'static>(
|
||||
cx: &'a ScopeState,
|
||||
atom: &'static AtomRef<T>,
|
||||
|
||||
@@ -2,10 +2,12 @@ use crate::{use_atom_root, AtomId, AtomRoot, Readable};
|
||||
use dioxus_core::{ScopeId, ScopeState};
|
||||
use std::rc::Rc;
|
||||
|
||||
#[must_use]
|
||||
pub fn use_read<V: 'static>(cx: &ScopeState, f: impl Readable<V>) -> &V {
|
||||
use_read_rc(cx, f).as_ref()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn use_read_rc<V: 'static>(cx: &ScopeState, f: impl Readable<V>) -> &Rc<V> {
|
||||
let root = use_atom_root(cx);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ use crate::{use_atom_root, Writable};
|
||||
use dioxus_core::ScopeState;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[must_use]
|
||||
pub fn use_set<T: 'static>(cx: &ScopeState, f: impl Writable<T>) -> &Rc<dyn Fn(T)> {
|
||||
let root = use_atom_root(cx);
|
||||
cx.use_hook(|| {
|
||||
|
||||
@@ -30,6 +30,7 @@ use std::{
|
||||
/// ))
|
||||
/// }
|
||||
/// ```
|
||||
#[must_use]
|
||||
pub fn use_atom_state<T: 'static>(cx: &ScopeState, f: impl Writable<T>) -> &AtomState<T> {
|
||||
let root = crate::use_atom_root(cx);
|
||||
|
||||
|
||||
Reference in new issue
Block a user