1234567891011121314151617181920212223242526272829303132333435 |
- //! Diffing is interruptible, but uses yield_now which is loop-pollable
- //!
- //! This means you can actually call it synchronously if you want.
- use anyhow::{Context, Result};
- use dioxus::{
- arena::SharedResources,
- diff::{CreateMeta, DiffInstruction, DiffMachine},
- prelude::*,
- scope::Scope,
- };
- use dioxus_core as dioxus;
- use dioxus_html as dioxus_elements;
- use futures_util::FutureExt;
- #[test]
- fn worksync() {
- static App: FC<()> = |cx| {
- cx.render(rsx! {
- div {"hello"}
- })
- };
- let mut dom = VirtualDom::new(App);
- let mut fut = dom.rebuild_async().boxed_local();
- let mutations = loop {
- let g = (&mut fut).now_or_never();
- if g.is_some() {
- break g.unwrap().unwrap();
- }
- };
- dbg!(mutations);
- }
|