fix formatting

This commit is contained in:
Evan Almloff committed 2024-03-04 12:04:09 -06:00
1 parent a14e5be7ad
commit 78b9b157dc
7 files changed
+40 -24

No files matched your search

+3 -1
View File
@@ -260,7 +260,9 @@ pub fn after_render(f: impl FnMut() + 'static) {
pub async fn flush_sync() {
// Wait for the flush lock to be available
// We release it immediately, so it's impossible for the lock to be held longer than this function
Runtime::with(|rt| rt.render_signal.subscribe()).unwrap().await;
Runtime::with(|rt| rt.render_signal.subscribe())
.unwrap()
.await;
}
/// Use a hook with a cleanup function
+1 -1
View File
@@ -14,13 +14,13 @@ mod global_context;
mod mutations;
mod nodes;
mod properties;
mod render_signal;
mod runtime;
mod scope_arena;
mod scope_context;
mod scopes;
mod tasks;
mod virtual_dom;
mod render_signal;
pub(crate) mod innerlude {
pub(crate) use crate::any_props::*;
+10 -11
View File
@@ -1,10 +1,10 @@
use std::rc::Rc;
use std::task::Waker;
use std::task::Poll;
use std::pin::Pin;
use std::future::Future;
use std::task::Context;
use std::cell::RefCell;
use std::future::Future;
use std::pin::Pin;
use std::rc::Rc;
use std::task::Context;
use std::task::Poll;
use std::task::Waker;
/// A signal is a message that can be sent to all listening tasks at once
#[derive(Default)]
@@ -26,15 +26,14 @@ impl RenderSignal {
}
/// Create a future that resolves when the signal is sent
pub fn subscribe(& self) -> RenderSignalFuture {
let inner =Rc::new(RefCell::new(RenderSignalFutureInner {
pub fn subscribe(&self) -> RenderSignalFuture {
let inner = Rc::new(RefCell::new(RenderSignalFutureInner {
resolved: false,
waker: None,
}));
self.wakers.borrow_mut().push(inner.clone());
let waker = RenderSignalFuture {
inner
};
println!("RenderSignalFutureInner");
let waker = RenderSignalFuture { inner };
waker
}
}
+1 -1
View File
@@ -1,9 +1,9 @@
use crate::{
innerlude::{LocalTask, SchedulerMsg},
render_signal::RenderSignal,
scope_context::Scope,
scopes::ScopeId,
Task,
render_signal::RenderSignal
};
use std::{
cell::{Cell, Ref, RefCell},
+1 -2
View File
@@ -478,7 +478,6 @@ impl VirtualDom {
match self.rx.next().await.expect("channel should never close") {
SchedulerMsg::Immediate(id) => self.mark_dirty(id),
SchedulerMsg::TaskNotified(id) => {
// _ = self.runtime.handle_task_wakeup(id)
// Instead of running the task immediately, we insert it into the runtime's task queue.
// The task may be marked dirty at the same time as the scope that owns the task is dropped.
self.mark_task_dirty(id);
@@ -631,8 +630,8 @@ impl VirtualDom {
}
}
self.scopes_need_rerun = false;
self.runtime.render_signal.send();
self.scopes_need_rerun = false;
}
/// [`Self::render_immediate`] to a vector of mutations for testing purposes