FIx: cargo fix to clean up things
This commit is contained in:
1 parent
29751a4bab
commit
78d093a945
23 files changed
+91
-101
No files matched your search
@@ -1,5 +1,5 @@
|
||||
use crate::{builder::BuildConfig, cli::DevelopOptions, config::Config, error::Result};
|
||||
use async_std::{channel, prelude::FutureExt};
|
||||
use async_std::{prelude::FutureExt};
|
||||
|
||||
use async_std::future;
|
||||
use async_std::prelude::*;
|
||||
@@ -57,7 +57,7 @@ async fn watch_directory(config: Config) -> Result<()> {
|
||||
.watch(src_dir.join("examples"), RecursiveMode::Recursive)
|
||||
.expect("Failed to watch dir");
|
||||
|
||||
let mut build_config = BuildConfig::default();
|
||||
let build_config = BuildConfig::default();
|
||||
|
||||
'run: loop {
|
||||
crate::builder::build(&config, &build_config)?;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
use dioxus_core_macro::fc;
|
||||
|
||||
|
||||
fn main() {}
|
||||
@@ -1,4 +1,4 @@
|
||||
use dioxus_core_macro::rsx;
|
||||
|
||||
|
||||
pub mod dioxus {
|
||||
pub mod builder {
|
||||
@@ -25,32 +25,32 @@ pub mod dioxus {
|
||||
|
||||
impl Builder {
|
||||
// fn attr<T>(mut self, key: &str, value: impl Into<AttrVal>) -> Self {
|
||||
pub fn attr<T>(mut self, key: &str, value: T) -> Self {
|
||||
pub fn attr<T>(self, _key: &str, _value: T) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
pub fn on<T>(mut self, key: &str, value: T) -> Self {
|
||||
pub fn on<T>(self, _key: &str, _value: T) -> Self {
|
||||
Self
|
||||
}
|
||||
|
||||
pub fn finish(mut self) {
|
||||
pub fn finish(self) {
|
||||
// Self
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Bump;
|
||||
pub fn div(bump: &Bump) -> Builder {
|
||||
pub fn div(_bump: &Bump) -> Builder {
|
||||
todo!()
|
||||
}
|
||||
pub fn h1(bump: &Bump) -> Builder {
|
||||
pub fn h1(_bump: &Bump) -> Builder {
|
||||
todo!()
|
||||
}
|
||||
pub fn h2(bump: &Bump) -> Builder {
|
||||
pub fn h2(_bump: &Bump) -> Builder {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
}
|
||||
use dioxus::builder::Bump;
|
||||
|
||||
pub fn main() {
|
||||
// render(rsx! {
|
||||
// div { // we can actually support just a list of nodes too
|
||||
@@ -86,7 +86,7 @@ pub fn main() {
|
||||
// }
|
||||
// });
|
||||
|
||||
let g = String::from("asd");
|
||||
let _g = String::from("asd");
|
||||
|
||||
// let lazy = rsx! {
|
||||
// div {
|
||||
@@ -124,4 +124,4 @@ pub fn main() {
|
||||
// render(lazy);
|
||||
}
|
||||
|
||||
fn render(f: impl Fn(&dioxus::builder::Bump)) {}
|
||||
fn render(_f: impl Fn(&dioxus::builder::Bump)) {}
|
||||
@@ -1,12 +1,12 @@
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::{quote, quote_spanned, ToTokens};
|
||||
use syn::spanned::Spanned;
|
||||
use quote::{quote, ToTokens};
|
||||
|
||||
use syn::{
|
||||
parse::{Parse, ParseStream},
|
||||
Signature,
|
||||
};
|
||||
use syn::{
|
||||
parse_macro_input, Attribute, Block, FnArg, Ident, Item, ItemFn, ReturnType, Type, Visibility,
|
||||
Attribute, Block, FnArg, Ident, Item, ItemFn, ReturnType, Type, Visibility,
|
||||
};
|
||||
|
||||
/// A parsed version of the user's input
|
||||
@@ -109,11 +109,11 @@ impl ToTokens for FunctionComponent {
|
||||
let FunctionComponent {
|
||||
block,
|
||||
// props_type,
|
||||
arg,
|
||||
vis,
|
||||
attrs,
|
||||
arg: _,
|
||||
vis: _,
|
||||
attrs: _,
|
||||
name: function_name,
|
||||
return_type,
|
||||
return_type: _,
|
||||
} = self;
|
||||
|
||||
// if function_name == component_name {
|
||||
@@ -192,19 +192,19 @@ pub fn ensure_fn_block(item: Item) -> syn::Result<ItemFn> {
|
||||
Item::Fn(it) => Ok(it),
|
||||
Item::Static(it) => {
|
||||
let syn::ItemStatic {
|
||||
attrs,
|
||||
vis,
|
||||
static_token,
|
||||
mutability,
|
||||
ident,
|
||||
colon_token,
|
||||
attrs: _,
|
||||
vis: _,
|
||||
static_token: _,
|
||||
mutability: _,
|
||||
ident: _,
|
||||
colon_token: _,
|
||||
ty,
|
||||
eq_token,
|
||||
expr,
|
||||
semi_token,
|
||||
eq_token: _,
|
||||
expr: _,
|
||||
semi_token: _,
|
||||
} = ⁢
|
||||
match ty.as_ref() {
|
||||
Type::BareFn(bare) => {}
|
||||
Type::BareFn(_bare) => {}
|
||||
// Type::Array(_)
|
||||
// | Type::Group(_)
|
||||
// | Type::ImplTrait(_)
|
||||
|
||||
@@ -147,7 +147,7 @@ struct Element {
|
||||
impl ToTokens for ToToksCtx<&Element> {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream2) {
|
||||
// let ctx = self.ctx;
|
||||
let name = &self.inner.name;
|
||||
let _name = &self.inner.name;
|
||||
tokens.append_all(quote! {
|
||||
dioxus::builder::ElementBuilder::new(ctx, "#name")
|
||||
});
|
||||
@@ -184,7 +184,7 @@ impl Parse for Element {
|
||||
s.parse::<Token![<]>()?;
|
||||
let name = Ident::parse_any(s)?;
|
||||
let mut attrs = vec![];
|
||||
let mut children: Vec<Node> = vec![];
|
||||
let _children: Vec<Node> = vec![];
|
||||
|
||||
// keep looking for attributes
|
||||
while !s.peek(Token![>]) {
|
||||
@@ -293,7 +293,7 @@ impl Parse for Attr {
|
||||
impl ToTokens for ToToksCtx<&Attr> {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream2) {
|
||||
let name = self.inner.name.to_string();
|
||||
let mut attr_stream = TokenStream2::new();
|
||||
let _attr_stream = TokenStream2::new();
|
||||
match &self.inner.ty {
|
||||
AttrType::Value(value) => {
|
||||
let value = self.recurse(value);
|
||||
|
||||
@@ -45,7 +45,7 @@ pub fn rsx(s: TokenStream) -> TokenStream {
|
||||
/// }
|
||||
/// ```
|
||||
#[proc_macro_attribute]
|
||||
pub fn fc(attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
pub fn fc(_attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
match syn::parse::<fc::FunctionComponent>(item) {
|
||||
Err(e) => e.to_compile_error().into(),
|
||||
Ok(s) => s.to_token_stream().into(),
|
||||
|
||||
@@ -10,7 +10,7 @@ use proc_macro2::TokenStream;
|
||||
|
||||
use syn::parse::Error;
|
||||
use syn::spanned::Spanned;
|
||||
use syn::{parse_macro_input, DeriveInput};
|
||||
|
||||
|
||||
use quote::quote;
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ impl ToTokens for ToToksCtx<&Component> {
|
||||
// tokens.append_all(quote! {
|
||||
// .finish()
|
||||
// });
|
||||
let toks = tokens.append_all(quote! {
|
||||
let _toks = tokens.append_all(quote! {
|
||||
dioxus::builder::virtual_child(ctx, #name, #builder)
|
||||
});
|
||||
}
|
||||
@@ -209,7 +209,7 @@ impl Parse for Component {
|
||||
syn::braced!(content in s);
|
||||
|
||||
let mut body: Vec<ComponentField> = Vec::new();
|
||||
let mut children: Vec<Node> = Vec::new();
|
||||
let _children: Vec<Node> = Vec::new();
|
||||
|
||||
// parse_element_content(content, &mut attrs, &mut children);
|
||||
|
||||
@@ -228,7 +228,7 @@ impl Parse for Component {
|
||||
|
||||
// eventually we'll parse the attrs
|
||||
// let mut attrs: Vec<Attr> = vec![];
|
||||
let mut children: Vec<Node> = vec![];
|
||||
let children: Vec<Node> = vec![];
|
||||
// parse_element_content(content, &mut attrs, &mut children);
|
||||
|
||||
let children = MaybeExpr::Literal(children);
|
||||
@@ -250,8 +250,8 @@ pub struct ComponentField {
|
||||
|
||||
impl Parse for ComponentField {
|
||||
fn parse(input: ParseStream) -> Result<Self> {
|
||||
let mut name = Ident::parse_any(input)?;
|
||||
let name_str = name.to_string();
|
||||
let name = Ident::parse_any(input)?;
|
||||
let _name_str = name.to_string();
|
||||
input.parse::<Token![:]>()?;
|
||||
let content = input.parse()?;
|
||||
|
||||
@@ -472,7 +472,7 @@ impl ToTokens for ToToksCtx<&Attr> {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream2) {
|
||||
let name = self.inner.name.to_string();
|
||||
let nameident = &self.inner.name;
|
||||
let mut attr_stream = TokenStream2::new();
|
||||
let _attr_stream = TokenStream2::new();
|
||||
match &self.inner.ty {
|
||||
AttrType::Value(value) => {
|
||||
let value = self.recurse(value);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
fn main() {}
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
|
||||
use dioxus_core::prelude::*;
|
||||
|
||||
@@ -22,7 +22,7 @@ struct ListItem {
|
||||
}
|
||||
|
||||
fn app(ctx: Context, props: &Props) -> DomTree {
|
||||
let (f, setter) = use_state(&ctx, || 0);
|
||||
let (_f, setter) = use_state(&ctx, || 0);
|
||||
|
||||
ctx.render(move |c| {
|
||||
let mut root = builder::ElementBuilder::new(c, "div");
|
||||
@@ -64,7 +64,7 @@ struct ChildProps<'a> {
|
||||
}
|
||||
|
||||
impl PartialEq for ChildProps<'_> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
fn eq(&self, _other: &Self) -> bool {
|
||||
// assume the dyn fn is never stable -
|
||||
// wrap with use_callback if it's an issue for you
|
||||
false
|
||||
@@ -78,7 +78,7 @@ impl<'a> Properties for ChildProps<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn ChildItem(ctx: Context, props: &ChildProps) -> DomTree {
|
||||
fn ChildItem(_ctx: Context, _props: &ChildProps) -> DomTree {
|
||||
todo!()
|
||||
// ctx.render(rsx! {
|
||||
// div {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use dioxus_core::component::fc_to_builder;
|
||||
use dioxus_core::prelude::*;
|
||||
use dioxus_core_macro::fc;
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
static BLAH: FC<()> = |ctx, props| {
|
||||
|
||||
|
||||
static BLAH: FC<()> = |ctx, _props| {
|
||||
let g = "asd".to_string();
|
||||
ctx.render(rsx! {
|
||||
div {
|
||||
@@ -20,7 +20,7 @@ pub struct ExampleProps {
|
||||
some_field: String,
|
||||
}
|
||||
|
||||
static SomeComponent: FC<ExampleProps> = |ctx, props| {
|
||||
static SomeComponent: FC<ExampleProps> = |ctx, _props| {
|
||||
ctx.render(rsx! {
|
||||
div { }
|
||||
})
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
// #[macro_use]
|
||||
extern crate fstrings;
|
||||
|
||||
use bumpalo::collections::String;
|
||||
|
||||
|
||||
// use dioxus_core::ifmt;
|
||||
// use fstrings::format_args_f;
|
||||
use bumpalo::core_alloc::fmt::Write;
|
||||
|
||||
|
||||
fn main() {
|
||||
let bump = bumpalo::Bump::new();
|
||||
let b = ≎
|
||||
let world = "123";
|
||||
let _b = ≎
|
||||
let _world = "123";
|
||||
// dioxus_core::ifmt!(in b; "Hello {world}";);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ struct SomeProps {
|
||||
fn main() {
|
||||
let g: SomeProps = SomeProps::builder().a(10).b(10).build();
|
||||
|
||||
let r = g.b.unwrap_or_else(|| 10);
|
||||
let _r = g.b.unwrap_or_else(|| 10);
|
||||
}
|
||||
|
||||
fn auto_into_some() {}
|
||||
@@ -1,4 +1,4 @@
|
||||
use bumpalo::Bump;
|
||||
|
||||
use dioxus_core::prelude::*;
|
||||
|
||||
fn main() {}
|
||||
@@ -26,8 +26,8 @@ struct Button<'a> {
|
||||
}
|
||||
|
||||
impl Render for Button<'_> {
|
||||
fn render(ctx: Context, props: &Self) -> DomTree {
|
||||
let onfocus = move |evt: ()| log::debug!("Focused");
|
||||
fn render(ctx: Context, _props: &Self) -> DomTree {
|
||||
let _onfocus = move |_evt: ()| log::debug!("Focused");
|
||||
|
||||
// todo!()
|
||||
ctx.render(rsx! {
|
||||
@@ -35,7 +35,7 @@ impl Render for Button<'_> {
|
||||
// ..props.attrs,
|
||||
class: "abc123",
|
||||
// style: { a: 2, b: 3, c: 4 },
|
||||
onclick: move |evt| {
|
||||
onclick: move |_evt| {
|
||||
// log::info("hello world");
|
||||
},
|
||||
// Custom1 { a: 123 }
|
||||
|
||||
@@ -3,7 +3,7 @@ use dioxus_core::{component::Properties, prelude::*};
|
||||
fn main() -> Result<(), ()> {
|
||||
let p1 = SomeProps { name: "bob".into() };
|
||||
|
||||
let mut vdom = VirtualDom::new_with_props(Example, p1);
|
||||
let _vdom = VirtualDom::new_with_props(Example, p1);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ impl Properties for () {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fc_to_builder<T: Properties>(f: FC<T>) -> T::Builder {
|
||||
pub fn fc_to_builder<T: Properties>(_f: FC<T>) -> T::Builder {
|
||||
T::builder()
|
||||
}
|
||||
@@ -34,11 +34,10 @@
|
||||
//! - https://hacks.mozilla.org/2019/03/fast-bump-allocated-virtual-doms-with-rust-and-wasm/
|
||||
use crate::{
|
||||
innerlude::*,
|
||||
scope::{create_scoped, Scoped},
|
||||
};
|
||||
use bumpalo::Bump;
|
||||
use fxhash::{FxHashMap, FxHashSet};
|
||||
use generational_arena::Arena;
|
||||
|
||||
use std::{cell::RefCell, cmp::Ordering, collections::VecDeque, rc::Rc};
|
||||
|
||||
/// The DiffState is a cursor internal to the VirtualDOM's diffing algorithm that allows persistence of state while
|
||||
@@ -112,7 +111,7 @@ impl<'a> DiffMachine<'a> {
|
||||
self.diff_children(eold.children, enew.children);
|
||||
}
|
||||
|
||||
(VNode::Component(cold), VNode::Component(cnew)) => {
|
||||
(VNode::Component(_cold), VNode::Component(_cnew)) => {
|
||||
// if cold.comp != cnew.comp {
|
||||
// // queue an event to mount this new component
|
||||
// return;
|
||||
@@ -123,7 +122,7 @@ impl<'a> DiffMachine<'a> {
|
||||
todo!("Usage of component VNode not currently supported");
|
||||
}
|
||||
|
||||
(_, VNode::Component(new)) => {
|
||||
(_, VNode::Component(_new)) => {
|
||||
// we have no stable reference to work from
|
||||
// push the lifecycle event onto the queue
|
||||
// self.lifecycle_events
|
||||
@@ -142,7 +141,7 @@ impl<'a> DiffMachine<'a> {
|
||||
// push the current
|
||||
}
|
||||
|
||||
(VNode::Component(old), _) => {
|
||||
(VNode::Component(_old), _) => {
|
||||
todo!("Usage of component VNode not currently supported");
|
||||
}
|
||||
|
||||
@@ -165,7 +164,7 @@ impl<'a> DiffMachine<'a> {
|
||||
self.change_list.commit_traversal();
|
||||
}
|
||||
|
||||
'outer1: for (l_idx, new_l) in new.iter().enumerate() {
|
||||
'outer1: for (_l_idx, new_l) in new.iter().enumerate() {
|
||||
// unsafe {
|
||||
// Safety relies on removing `new_l` from the registry manually at
|
||||
// the end of its lifetime. This happens below in the `'outer2`
|
||||
@@ -818,7 +817,7 @@ impl<'a> DiffMachine<'a> {
|
||||
self.change_list.create_element(tag_name);
|
||||
}
|
||||
|
||||
listeners.iter().enumerate().for_each(|(id, listener)| {
|
||||
listeners.iter().enumerate().for_each(|(_id, listener)| {
|
||||
self.change_list
|
||||
.new_event_listener(listener.event, listener.scope, listener.id)
|
||||
});
|
||||
|
||||
@@ -137,7 +137,7 @@ mod use_reducer_def {
|
||||
pub fn use_reducer<'a, 'c, State: 'static, Action: 'static>(
|
||||
ctx: &'c Context<'a>,
|
||||
initial_state_fn: impl FnOnce() -> State,
|
||||
reducer: impl Fn(&mut State, Action),
|
||||
_reducer: impl Fn(&mut State, Action),
|
||||
) -> (&'a State, &'a impl Fn(Action)) {
|
||||
ctx.use_hook(
|
||||
move || UseReducer {
|
||||
@@ -146,7 +146,7 @@ mod use_reducer_def {
|
||||
caller: Box::new(|_| println!("setter called!")),
|
||||
},
|
||||
move |hook| {
|
||||
let inner = hook.new_val.clone();
|
||||
let _inner = hook.new_val.clone();
|
||||
let scheduled_update = ctx.schedule_update();
|
||||
|
||||
// get ownership of the new val and replace the current with the new
|
||||
@@ -157,7 +157,7 @@ mod use_reducer_def {
|
||||
}
|
||||
|
||||
// todo: swap out the caller with a subscription call and an internal update
|
||||
hook.caller = Box::new(move |new_val| {
|
||||
hook.caller = Box::new(move |_new_val| {
|
||||
// update the setter with the new value
|
||||
// let mut new_inner = inner.as_ref().borrow_mut();
|
||||
// *new_inner = Some(new_val);
|
||||
@@ -175,9 +175,9 @@ mod use_reducer_def {
|
||||
|
||||
// #[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::prelude::*;
|
||||
use bumpalo::Bump;
|
||||
|
||||
enum Actions {
|
||||
Incr,
|
||||
Decr,
|
||||
|
||||
@@ -91,11 +91,11 @@ pub(crate) mod innerlude {
|
||||
// pub(crate) use crate::component::Properties;
|
||||
pub(crate) use crate::component::Properties;
|
||||
pub(crate) use crate::context::Context;
|
||||
pub(crate) use crate::error::{Error, Result};
|
||||
pub(crate) use crate::error::{Result};
|
||||
pub use crate::events::EventTrigger;
|
||||
use crate::nodes;
|
||||
pub(crate) use crate::scope::Scope;
|
||||
pub(crate) use crate::virtual_dom::VirtualDom;
|
||||
|
||||
|
||||
pub(crate) use nodes::*;
|
||||
|
||||
pub use crate::component::ScopeIdx;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Helpers for building virtual DOM VNodes.
|
||||
|
||||
use std::{borrow::BorrowMut, ops::Deref};
|
||||
use std::{borrow::BorrowMut};
|
||||
|
||||
use crate::{
|
||||
context::NodeCtx,
|
||||
@@ -10,8 +10,8 @@ use crate::{
|
||||
prelude::VElement,
|
||||
};
|
||||
|
||||
use bumpalo::format;
|
||||
use bumpalo::Bump;
|
||||
|
||||
|
||||
|
||||
/// A virtual DOM element builder.
|
||||
///
|
||||
@@ -339,7 +339,7 @@ where
|
||||
/// })
|
||||
/// .finish();
|
||||
/// ```
|
||||
pub fn on(mut self, event: &'static str, callback: impl Fn(VirtualEvent) + 'a) -> Self {
|
||||
pub fn on(self, event: &'static str, callback: impl Fn(VirtualEvent) + 'a) -> Self {
|
||||
let listener = Listener {
|
||||
event,
|
||||
callback: self.ctx.bump.alloc(callback),
|
||||
@@ -527,9 +527,9 @@ pub fn attr<'a>(name: &'static str, value: &'a str) -> Attribute<'a> {
|
||||
// _f: crate::innerlude::FC<T>,
|
||||
// _props: T
|
||||
pub fn virtual_child<'a, 'b, T: crate::innerlude::Properties>(
|
||||
ctx: &'b NodeCtx<'a>,
|
||||
f: FC<T>,
|
||||
p: T,
|
||||
_ctx: &'b NodeCtx<'a>,
|
||||
_f: FC<T>,
|
||||
_p: T,
|
||||
) -> VNode<'a> {
|
||||
// crate::nodes::VComponent
|
||||
todo!()
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::{
|
||||
use bumpalo::Bump;
|
||||
use std::fmt::Debug;
|
||||
use std::{
|
||||
any::{Any, TypeId},
|
||||
any::{Any},
|
||||
cell::RefCell,
|
||||
marker::PhantomData,
|
||||
rc::Rc,
|
||||
@@ -280,14 +280,14 @@ pub struct VComponent<'src> {
|
||||
}
|
||||
pub struct Comparator(Box<dyn Fn(&dyn Any) -> bool>);
|
||||
impl std::fmt::Debug for Comparator {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Caller(Box<dyn Fn(Context) -> DomTree>);
|
||||
impl std::fmt::Debug for Caller {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ use crate::nodes::VNode;
|
||||
use bumpalo::Bump;
|
||||
|
||||
use std::{
|
||||
any::{Any, TypeId},
|
||||
any::{Any},
|
||||
cell::RefCell,
|
||||
marker::PhantomData,
|
||||
ops::Deref,
|
||||
@@ -145,7 +145,7 @@ impl<P: Properties + 'static> Scoped for Scope<P> {
|
||||
.expect("Viewing did not happen");
|
||||
}
|
||||
|
||||
fn compare_props(&self, new: &Any) -> bool {
|
||||
fn compare_props(&self, new: &dyn Any) -> bool {
|
||||
new.downcast_ref::<P>()
|
||||
.map(|f| &self.props == f)
|
||||
.expect("Props should not be of a different type")
|
||||
|
||||
@@ -7,16 +7,7 @@ use crate::{
|
||||
};
|
||||
use bumpalo::Bump;
|
||||
use generational_arena::Arena;
|
||||
use std::{
|
||||
any::TypeId,
|
||||
borrow::BorrowMut,
|
||||
cell::{RefCell, UnsafeCell},
|
||||
collections::{vec_deque, VecDeque},
|
||||
future::Future,
|
||||
marker::PhantomData,
|
||||
rc::Rc,
|
||||
sync::atomic::AtomicUsize,
|
||||
};
|
||||
|
||||
|
||||
/// An integrated virtual node system that progresses events and diffs UI trees.
|
||||
/// Differences are converted into patches which a renderer can use to draw the UI.
|
||||
@@ -68,7 +59,7 @@ impl VirtualDom {
|
||||
///
|
||||
/// This is useful when a component tree can be driven by external state (IE SSR) but it would be too expensive
|
||||
/// to toss out the entire tree.
|
||||
pub fn new_with_props<P: Properties + 'static>(root: FC<P>, root_props: P) -> Self {
|
||||
pub fn new_with_props<P: Properties + 'static>(_root: FC<P>, _root_props: P) -> Self {
|
||||
// let mut components = Arena::new();
|
||||
// let mut components = Arena::new();
|
||||
|
||||
@@ -104,7 +95,7 @@ impl VirtualDom {
|
||||
.expect("Root should always exist")
|
||||
.run();
|
||||
|
||||
let b = Bump::new();
|
||||
let _b = Bump::new();
|
||||
|
||||
let mut diff_machine = DiffMachine::new(&self.diff_bump);
|
||||
// let mut diff_machine = DiffMachine::new(self, &self.diff_bump, self.base_scope);
|
||||
@@ -142,7 +133,7 @@ impl VirtualDom {
|
||||
/// }
|
||||
///
|
||||
/// ```
|
||||
pub fn progress_with_event(&mut self, event: EventTrigger) -> Result<EditList<'_>> {
|
||||
pub fn progress_with_event(&mut self, _event: EventTrigger) -> Result<EditList<'_>> {
|
||||
// self.components
|
||||
// .borrow_mut()
|
||||
// .get_mut(event.component_id)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use dioxus_core::prelude::*;
|
||||
|
||||
|
||||
fn main() {
|
||||
// let mut s = Context { props: &() };
|
||||
|
||||
Reference in new issue
Block a user