feat: integrate fermi
This commit is contained in:
1 parent
3873cd1a60
commit
d461ffc011
23 files changed
+630
-15
No files matched your search
@@ -0,0 +1,51 @@
|
||||
use std::{future::Future, rc::Rc};
|
||||
|
||||
use dioxus_core::prelude::*;
|
||||
|
||||
use crate::{Atom, AtomRoot, Readable, Writable};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct CallbackApi {
|
||||
root: Rc<AtomRoot>,
|
||||
}
|
||||
|
||||
impl CallbackApi {
|
||||
// get the current value of the atom
|
||||
pub fn get<V>(&self, atom: impl Readable<V>) -> &V {
|
||||
todo!()
|
||||
}
|
||||
|
||||
// get the current value of the atom in its RC container
|
||||
pub fn get_rc<V>(&self, atom: impl Readable<V>) -> &Rc<V> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
// set the current value of the atom
|
||||
pub fn set<V>(&self, atom: impl Writable<V>, value: V) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn use_atom_context(cx: &ScopeState) -> &CallbackApi {
|
||||
todo!()
|
||||
}
|
||||
|
||||
macro_rules! use_callback {
|
||||
(&$cx:ident, [$($cap:ident),*], move || $body:expr) => {
|
||||
move || {
|
||||
$(
|
||||
#[allow(unused_mut)]
|
||||
let mut $cap = $cap.to_owned();
|
||||
)*
|
||||
$cx.spawn($body);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! to_owned {
|
||||
($($es:ident),+) => {$(
|
||||
#[allow(unused_mut)]
|
||||
let mut $es = $es.to_owned();
|
||||
)*}
|
||||
}
|
||||
Reference in new issue
Block a user