chore: update docs

This commit is contained in:
Jonathan Kelley committed 2022-11-30 10:31:44 -05:00
1 parent 03aea885cf
commit 16a521a601
5 files changed
+75 -62

No files matched your search

+4 -5
View File
@@ -14,7 +14,7 @@ use std::cell::Cell;
use DynamicNode::*;
impl<'b> VirtualDom {
pub fn diff_scope(&mut self, scope: ScopeId) {
pub(super) fn diff_scope(&mut self, scope: ScopeId) {
let scope_state = &mut self.scopes[scope.0];
self.scope_stack.push(scope);
@@ -59,7 +59,7 @@ impl<'b> VirtualDom {
todo!("Not yet handling error rollover")
}
pub fn diff_node(&mut self, left_template: &'b VNode<'b>, right_template: &'b VNode<'b>) {
fn diff_node(&mut self, left_template: &'b VNode<'b>, right_template: &'b VNode<'b>) {
if left_template.template.id != right_template.template.id {
return self.light_diff_templates(left_template, right_template);
}
@@ -185,7 +185,7 @@ impl<'b> VirtualDom {
/// This is mostly implemented to help solve the issue where the same component is rendered under two different
/// conditions:
///
/// ```rust
/// ```rust, ignore
/// if enabled {
/// rsx!{ Component { enabled_sign: "abc" } }
/// } else {
@@ -196,8 +196,7 @@ impl<'b> VirtualDom {
/// However, we should not that it's explicit in the docs that this is not a guarantee. If you need to preserve state,
/// then you should be passing in separate props instead.
///
/// ```
///
/// ```rust, ignore
/// let props = if enabled {
/// ComponentProps { enabled_sign: "abc" }
/// } else {
+2
View File
@@ -1,3 +1,5 @@
#![doc = include_str!("../README.md")]
mod any_props;
mod arena;
mod bump_frame;
+5 -9
View File
@@ -94,9 +94,9 @@ use std::{
/// ## Building an event loop around Dioxus:
///
/// Putting everything together, you can build an event loop around Dioxus by using the methods outlined above.
/// ```rust
/// ```rust, ignore
/// fn app(cx: Scope) -> Element {
/// cx.render(rsx!{
/// cx.render(rsx! {
/// div { "Hello World" }
/// })
/// }
@@ -121,7 +121,7 @@ use std::{
/// where waiting on portions of the UI to finish rendering is important. To wait for suspense, use the
/// [`VirtualDom::render_with_deadline`] method:
///
/// ```rust
/// ```rust, ignore
/// let dom = VirtualDom::new(app);
///
/// let deadline = tokio::time::sleep(Duration::from_millis(100));
@@ -134,7 +134,7 @@ use std::{
/// suggest rendering with a deadline, and then looping between [`VirtualDom::wait_for_work`] and render_immediate until
/// no suspended work is left.
///
/// ```
/// ```rust, ignore
/// let dom = VirtualDom::new(app);
///
/// let deadline = tokio::time::sleep(Duration::from_millis(20));
@@ -290,11 +290,6 @@ impl VirtualDom {
self.dirty_scopes.insert(DirtyScope { height, id });
}
/// Mark the entire tree as dirty.
///
/// Will force a re-render of every component
pub fn mark_dirty_all(&mut self) {}
/// Determine whether or not a scope is currently in a suspended state
///
/// This does not mean the scope is waiting on its own futures, just that the tree that the scope exists in is
@@ -609,6 +604,7 @@ impl VirtualDom {
impl Drop for VirtualDom {
fn drop(&mut self) {
// Simply drop this scope which drops all of its children
self.drop_scope(ScopeId(0));
}
}