more progress on macro
This commit is contained in:
1 parent
29a61b1855
commit
0e17199e7a
4 files changed
+209
-176
No files matched your search
@@ -3,7 +3,7 @@ extern crate proc_macro;
|
|||||||
mod sorted_slice;
|
mod sorted_slice;
|
||||||
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
use quote::{quote, ToTokens};
|
use quote::{quote, ToTokens, __private::Span};
|
||||||
use sorted_slice::StrSlice;
|
use sorted_slice::StrSlice;
|
||||||
use syn::parenthesized;
|
use syn::parenthesized;
|
||||||
use syn::parse::ParseBuffer;
|
use syn::parse::ParseBuffer;
|
||||||
@@ -148,8 +148,17 @@ fn impl_derive_macro(ast: &syn::DeriveInput) -> TokenStream {
|
|||||||
let strct = Struct::new(type_name.clone(), &fields);
|
let strct = Struct::new(type_name.clone(), &fields);
|
||||||
match StateStruct::parse(&fields, &strct) {
|
match StateStruct::parse(&fields, &strct) {
|
||||||
Ok(state_strct) => {
|
Ok(state_strct) => {
|
||||||
let member_types1 = state_strct.state_members.iter().map(|m| &m.mem.ty);
|
let passes = state_strct.state_members.iter().map(|m| {
|
||||||
let member_types2 = state_strct.state_members.iter().map(|m| &m.mem.ty);
|
let unit = &m.mem.unit_type;
|
||||||
|
match m.dep_kind {
|
||||||
|
DependencyKind::Node => quote! {dioxus_native_core::AnyPass::Node(&#unit)},
|
||||||
|
DependencyKind::Child => quote! {dioxus_native_core::AnyPass::Upward(&#unit)},
|
||||||
|
DependencyKind::Parent => {
|
||||||
|
quote! {dioxus_native_core::AnyPass::Downward(&#unit)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let member_types = state_strct.state_members.iter().map(|m| &m.mem.ty);
|
||||||
let impl_members = state_strct
|
let impl_members = state_strct
|
||||||
.state_members
|
.state_members
|
||||||
.iter()
|
.iter()
|
||||||
@@ -162,9 +171,9 @@ fn impl_derive_macro(ast: &syn::DeriveInput) -> TokenStream {
|
|||||||
#(#impl_members)*
|
#(#impl_members)*
|
||||||
impl State for #type_name {
|
impl State for #type_name {
|
||||||
const PASSES: &'static [dioxus_native_core::AnyPass<dioxus_native_core::node::Node<Self>>] = &[
|
const PASSES: &'static [dioxus_native_core::AnyPass<dioxus_native_core::node::Node<Self>>] = &[
|
||||||
#(dioxus_native_core::AnyPass(&#member_types1)),*
|
#(#passes),*
|
||||||
];
|
];
|
||||||
const MASKS: &'static [dioxus_native_core::NodeMask] = &[#(#member_types2::NODE_MASK),*];
|
const MASKS: &'static [dioxus_native_core::NodeMask] = &[#(#member_types::NODE_MASK),*];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
gen.into()
|
gen.into()
|
||||||
@@ -183,7 +192,7 @@ impl Struct {
|
|||||||
let members = fields
|
let members = fields
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter_map(|(i, f)| Member::parse(f, 1 << i))
|
.filter_map(|(i, f)| Member::parse(f, i as u64))
|
||||||
.collect();
|
.collect();
|
||||||
Self { name, members }
|
Self { name, members }
|
||||||
}
|
}
|
||||||
@@ -285,6 +294,7 @@ impl Parse for Dependency {
|
|||||||
struct Member {
|
struct Member {
|
||||||
id: u64,
|
id: u64,
|
||||||
ty: Type,
|
ty: Type,
|
||||||
|
unit_type: Ident,
|
||||||
ident: Ident,
|
ident: Ident,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,6 +303,11 @@ impl Member {
|
|||||||
Some(Self {
|
Some(Self {
|
||||||
id,
|
id,
|
||||||
ty: field.ty.clone(),
|
ty: field.ty.clone(),
|
||||||
|
unit_type: Ident::new(
|
||||||
|
("_Unit".to_string() + field.ty.to_token_stream().to_string().as_str()).as_str(),
|
||||||
|
Span::call_site(),
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
ident: field.ident.as_ref()?.clone(),
|
ident: field.ident.as_ref()?.clone(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -378,13 +393,14 @@ impl<'a> StateMember<'a> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let ty = &self.mem.ty;
|
let ty = &self.mem.ty;
|
||||||
|
let unit_type = &self.mem.unit_type;
|
||||||
let node_view = quote!(dioxus_native_core::node_ref::NodeView::new(unsafe{&*{&node.node_data as *const _}}, #ty::NODE_MASK));
|
let node_view = quote!(dioxus_native_core::node_ref::NodeView::new(unsafe{&*{&node.node_data as *const _}}, #ty::NODE_MASK));
|
||||||
let dep_idents = self.dep_mems.iter().map(|m| &m.ident);
|
let dep_idents = self.dep_mems.iter().map(|m| &m.ident);
|
||||||
let impl_specific = match self.dep_kind {
|
let impl_specific = match self.dep_kind {
|
||||||
DependencyKind::Node => {
|
DependencyKind::Node => {
|
||||||
quote! {
|
quote! {
|
||||||
impl NodePass<#parent_type> for #ty {
|
impl dioxus_native_core::NodePass<dioxus_native_core::node::Node<#parent_type>> for #unit_type {
|
||||||
fn pass(&self, node: &mut T, ctx: &SendAnyMap) -> bool {
|
fn pass(&self, node: &mut dioxus_native_core::node::Node<#parent_type>, ctx: &dioxus_native_core::SendAnyMap) -> bool {
|
||||||
node.state.#ident.reduce(#node_view, (#(&node.state.#dep_idents,)*), #get_ctx)
|
node.state.#ident.reduce(#node_view, (#(&node.state.#dep_idents,)*), #get_ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -394,12 +410,12 @@ impl<'a> StateMember<'a> {
|
|||||||
let update = if self.dep_mems.iter().any(|m| m.id == self.mem.id) {
|
let update = if self.dep_mems.iter().any(|m| m.id == self.mem.id) {
|
||||||
quote! {
|
quote! {
|
||||||
if update {
|
if update {
|
||||||
PassReturn{
|
dioxus_native_core::PassReturn{
|
||||||
progress: true,
|
progress: true,
|
||||||
mark_dirty: true,
|
mark_dirty: true,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PassReturn{
|
dioxus_native_core::PassReturn{
|
||||||
progress: false,
|
progress: false,
|
||||||
mark_dirty: false,
|
mark_dirty: false,
|
||||||
}
|
}
|
||||||
@@ -408,12 +424,12 @@ impl<'a> StateMember<'a> {
|
|||||||
} else {
|
} else {
|
||||||
quote! {
|
quote! {
|
||||||
if update {
|
if update {
|
||||||
PassReturn{
|
dioxus_native_core::PassReturn{
|
||||||
progress: false,
|
progress: false,
|
||||||
mark_dirty: true,
|
mark_dirty: true,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PassReturn{
|
dioxus_native_core::PassReturn{
|
||||||
progress: false,
|
progress: false,
|
||||||
mark_dirty: false,
|
mark_dirty: false,
|
||||||
}
|
}
|
||||||
@@ -421,13 +437,13 @@ impl<'a> StateMember<'a> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
quote!(
|
quote!(
|
||||||
pub trait UpwardPass<T>: Pass {
|
impl dioxus_native_core::UpwardPass<dioxus_native_core::node::Node<#parent_type>> for #unit_type{
|
||||||
fn pass<'a>(
|
fn pass<'a>(
|
||||||
&self,
|
&self,
|
||||||
node: &mut T,
|
node: &mut dioxus_native_core::node::Node<#parent_type>,
|
||||||
children: &mut dyn Iterator<Item = &'a mut T>,
|
children: &mut dyn Iterator<Item = &'a mut dioxus_native_core::node::Node<#parent_type>>,
|
||||||
ctx: &SendAnyMap,
|
ctx: &dioxus_native_core::SendAnyMap,
|
||||||
) -> PassReturn {
|
) -> dioxus_native_core::PassReturn {
|
||||||
let update = node.state.#ident.reduce(#node_view, children.map(|c| (#(&c.state.#dep_idents,)*)), #get_ctx);
|
let update = node.state.#ident.reduce(#node_view, children.map(|c| (#(&c.state.#dep_idents,)*)), #get_ctx);
|
||||||
#update
|
#update
|
||||||
}
|
}
|
||||||
@@ -438,12 +454,12 @@ impl<'a> StateMember<'a> {
|
|||||||
let update = if self.dep_mems.iter().any(|m| m.id == self.mem.id) {
|
let update = if self.dep_mems.iter().any(|m| m.id == self.mem.id) {
|
||||||
quote! {
|
quote! {
|
||||||
if update {
|
if update {
|
||||||
PassReturn{
|
dioxus_native_core::PassReturn{
|
||||||
progress: true,
|
progress: true,
|
||||||
mark_dirty: true,
|
mark_dirty: true,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PassReturn{
|
dioxus_native_core::PassReturn{
|
||||||
progress: false,
|
progress: false,
|
||||||
mark_dirty: false,
|
mark_dirty: false,
|
||||||
}
|
}
|
||||||
@@ -452,12 +468,12 @@ impl<'a> StateMember<'a> {
|
|||||||
} else {
|
} else {
|
||||||
quote! {
|
quote! {
|
||||||
if update {
|
if update {
|
||||||
PassReturn{
|
dioxus_native_core::PassReturn{
|
||||||
progress: false,
|
progress: false,
|
||||||
mark_dirty: true,
|
mark_dirty: true,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PassReturn{
|
dioxus_native_core::PassReturn{
|
||||||
progress: false,
|
progress: false,
|
||||||
mark_dirty: false,
|
mark_dirty: false,
|
||||||
}
|
}
|
||||||
@@ -465,9 +481,9 @@ impl<'a> StateMember<'a> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
quote!(
|
quote!(
|
||||||
impl DownwardPass<#parent_type> for #ty {
|
impl dioxus_native_core::DownwardPass<dioxus_native_core::node::Node<#parent_type>> for #unit_type {
|
||||||
fn pass(&self, node: &mut T, parent: Option<&mut T>, ctx: &SendAnyMap) -> PassReturn{
|
fn pass(&self, node: &mut dioxus_native_core::node::Node<#parent_type>, parent: Option<&mut dioxus_native_core::node::Node<#parent_type>>, ctx: &dioxus_native_core::SendAnyMap) -> dioxus_native_core::PassReturn{
|
||||||
let update = current_state.state.#ident.reduce(#node_view, parent.as_ref().map(|p| (#(&p.state.#dep_idents,)*)), #get_ctx);
|
let update = node.state.#ident.reduce(#node_view, parent.as_ref().map(|p| (#(&p.state.#dep_idents,)*)), #get_ctx);
|
||||||
#update
|
#update
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -483,19 +499,21 @@ impl<'a> StateMember<'a> {
|
|||||||
.map(|m| m.id)
|
.map(|m| m.id)
|
||||||
.fold(self.mem.id, |a, b| a | b);
|
.fold(self.mem.id, |a, b| a | b);
|
||||||
quote! {
|
quote! {
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
struct #unit_type;
|
||||||
#impl_specific
|
#impl_specific
|
||||||
impl Pass for #ty {
|
impl dioxus_native_core::Pass for #unit_type {
|
||||||
fn pass_id(&self) -> PassId {
|
fn pass_id(&self) -> dioxus_native_core::PassId {
|
||||||
PassId(#pass_id)
|
dioxus_native_core::PassId(#pass_id)
|
||||||
}
|
}
|
||||||
fn dependancies(&self) -> &'static [PassId] {
|
fn dependancies(&self) -> &'static [dioxus_native_core::PassId] {
|
||||||
&[#(PassId(#depenancies)),*]
|
&[#(dioxus_native_core::PassId(#depenancies)),*]
|
||||||
}
|
}
|
||||||
fn dependants(&self) -> &'static [PassId] {
|
fn dependants(&self) -> &'static [dioxus_native_core::PassId] {
|
||||||
&[#(PassId(#dependants)),*]
|
&[#(dioxus_native_core::PassId(#dependants)),*]
|
||||||
}
|
}
|
||||||
fn mask(&self) -> MemberMask {
|
fn mask(&self) -> dioxus_native_core::MemberMask {
|
||||||
MemberMask(#mask)
|
dioxus_native_core::MemberMask(1 << #mask)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,161 +1,174 @@
|
|||||||
// use anymap::AnyMap;
|
use anymap::AnyMap;
|
||||||
// use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
// use dioxus_native_core::node_ref::*;
|
use dioxus_native_core::node_ref::*;
|
||||||
// use dioxus_native_core::real_dom::*;
|
use dioxus_native_core::real_dom::*;
|
||||||
// use dioxus_native_core::state::{ChildDepState, NodeDepState, ParentDepState, State};
|
use dioxus_native_core::state::{
|
||||||
// use dioxus_native_core_macro::State;
|
ChildDepState, ElementBorrowable, NodeDepState, ParentDepState, State,
|
||||||
|
};
|
||||||
|
use dioxus_native_core::tree::*;
|
||||||
|
use dioxus_native_core_macro::State;
|
||||||
|
|
||||||
// macro_rules! dep {
|
macro_rules! dep {
|
||||||
// ( child( $name:ty, $dep:ty ) ) => {
|
( child( $name:ty, $dep:ty ) ) => {
|
||||||
// impl ChildDepState for $name {
|
impl ChildDepState for $name {
|
||||||
// type Ctx = ();
|
type Ctx = ();
|
||||||
// type DepState = $dep;
|
type DepState = $dep;
|
||||||
// const NODE_MASK: NodeMask = NodeMask::ALL;
|
const NODE_MASK: NodeMask = NodeMask::ALL;
|
||||||
// fn reduce<'a>(
|
fn reduce<'a>(
|
||||||
// &mut self,
|
&mut self,
|
||||||
// _: NodeView,
|
_: NodeView,
|
||||||
// _: impl Iterator<Item = &'a Self::DepState>,
|
_: impl Iterator<Item = <Self::DepState as ElementBorrowable>::ElementBorrowed<'a>>,
|
||||||
// _: &Self::Ctx,
|
_: &Self::Ctx,
|
||||||
// ) -> bool
|
) -> bool
|
||||||
// where
|
where
|
||||||
// Self::DepState: 'a,
|
Self::DepState: 'a,
|
||||||
// {
|
{
|
||||||
// self.0 += 1;
|
self.0 += 1;
|
||||||
// true
|
true
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// };
|
};
|
||||||
|
|
||||||
// ( parent( $name:ty, $dep:ty ) ) => {
|
( parent( $name:ty, $dep:ty ) ) => {
|
||||||
// impl ParentDepState for $name {
|
impl ParentDepState for $name {
|
||||||
// type Ctx = ();
|
type Ctx = ();
|
||||||
// type DepState = $dep;
|
type DepState = $dep;
|
||||||
// const NODE_MASK: NodeMask = NodeMask::ALL;
|
const NODE_MASK: NodeMask = NodeMask::ALL;
|
||||||
// fn reduce(&mut self, _: NodeView, _: Option<&Self::DepState>, _: &Self::Ctx) -> bool {
|
fn reduce(
|
||||||
// self.0 += 1;
|
&mut self,
|
||||||
// true
|
_: NodeView,
|
||||||
// }
|
_: Option<<Self::DepState as ElementBorrowable>::ElementBorrowed<'_>>,
|
||||||
// }
|
_: &Self::Ctx,
|
||||||
// };
|
) -> bool {
|
||||||
|
self.0 += 1;
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// ( node( $name:ty, $dep:ty ) ) => {
|
( node( $name:ty, $dep:ty ) ) => {
|
||||||
// impl NodeDepState for $name {
|
impl NodeDepState for $name {
|
||||||
// type Ctx = ();
|
type Ctx = ();
|
||||||
// type DepState<'a> = $dep;
|
type DepState = $dep;
|
||||||
// const NODE_MASK: NodeMask = NodeMask::ALL;
|
const NODE_MASK: NodeMask = NodeMask::ALL;
|
||||||
// fn reduce(&mut self, _: NodeView, _: $dep, _: &Self::Ctx) -> bool {
|
fn reduce(
|
||||||
// self.0 += 1;
|
&mut self,
|
||||||
// true
|
_: NodeView,
|
||||||
// }
|
_: <Self::DepState as ElementBorrowable>::ElementBorrowed<'_>,
|
||||||
// }
|
_: &Self::Ctx,
|
||||||
// };
|
) -> bool {
|
||||||
// }
|
self.0 += 1;
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// macro_rules! test_state{
|
macro_rules! test_state{
|
||||||
// ( $s:ty, child: ( $( $child:ident ),* ), node: ( $( $node:ident ),* ), parent: ( $( $parent:ident ),* ) ) => {
|
( $s:ty, child: ( $( $child:ident ),* ), node: ( $( $node:ident ),* ), parent: ( $( $parent:ident ),* ) ) => {
|
||||||
// #[test]
|
#[test]
|
||||||
// fn state_reduce_initally_called_minimally() {
|
fn state_reduce_initally_called_minimally() {
|
||||||
// #[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
// fn Base(cx: Scope) -> Element {
|
fn Base(cx: Scope) -> Element {
|
||||||
// render!(div {
|
render!(div {
|
||||||
// div{
|
div{
|
||||||
// div{
|
div{
|
||||||
// p{}
|
p{}
|
||||||
// }
|
}
|
||||||
// p{
|
p{
|
||||||
// "hello"
|
"hello"
|
||||||
// }
|
}
|
||||||
// div{
|
div{
|
||||||
// h1{}
|
h1{}
|
||||||
// }
|
}
|
||||||
// p{
|
p{
|
||||||
// "world"
|
"world"
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// }
|
}
|
||||||
|
|
||||||
// let vdom = VirtualDom::new(Base);
|
let vdom = VirtualDom::new(Base);
|
||||||
|
|
||||||
// let mutations = vdom.create_vnodes(rsx! {
|
let mutations = vdom.create_vnodes(rsx! {
|
||||||
// div {
|
div {
|
||||||
// div{
|
div{
|
||||||
// div{
|
div{
|
||||||
// p{}
|
p{}
|
||||||
// }
|
}
|
||||||
// p{
|
p{
|
||||||
// "hello"
|
"hello"
|
||||||
// }
|
}
|
||||||
// div{
|
div{
|
||||||
// h1{}
|
h1{}
|
||||||
// }
|
}
|
||||||
// p{
|
p{
|
||||||
// "world"
|
"world"
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
// let mut dom: RealDom<$s> = RealDom::new();
|
let mut dom: RealDom<$s> = RealDom::new();
|
||||||
|
|
||||||
// let nodes_updated = dom.apply_mutations(vec![mutations]);
|
let nodes_updated = dom.apply_mutations(vec![mutations]);
|
||||||
// let _to_rerender = dom.update_state(nodes_updated, AnyMap::new());
|
let _to_rerender = dom.update_state(nodes_updated, AnyMap::new());
|
||||||
|
|
||||||
// dom.traverse_depth_first(|n| {
|
dom.traverse_depth_first(|n| {
|
||||||
// $(
|
$(
|
||||||
// assert_eq!(n.state.$child.0, 1);
|
assert_eq!(n.state.$child.0, 1);
|
||||||
// )*
|
)*
|
||||||
// $(
|
$(
|
||||||
// assert_eq!(n.state.$node.0, 1);
|
assert_eq!(n.state.$node.0, 1);
|
||||||
// )*
|
)*
|
||||||
// $(
|
$(
|
||||||
// assert_eq!(n.state.$parent.0, 1);
|
assert_eq!(n.state.$parent.0, 1);
|
||||||
// )*
|
)*
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// mod node_depends_on_child_and_parent {
|
mod node_depends_on_child_and_parent {
|
||||||
// use super::*;
|
use super::*;
|
||||||
// #[derive(Debug, Clone, Default, PartialEq)]
|
#[derive(Debug, Clone, Default, PartialEq)]
|
||||||
// struct Node(i32);
|
struct Node(i32);
|
||||||
// dep!(node(Node, (&'a Child, &'a Parent)));
|
dep!(node(Node, (Child, Parent)));
|
||||||
|
|
||||||
// #[derive(Debug, Clone, Default, PartialEq)]
|
#[derive(Debug, Clone, Default, PartialEq)]
|
||||||
// struct Child(i32);
|
struct Child(i32);
|
||||||
// dep!(child(Child, Child));
|
dep!(child(Child, (Child,)));
|
||||||
|
|
||||||
// #[derive(Debug, Clone, Default, PartialEq)]
|
#[derive(Debug, Clone, Default, PartialEq)]
|
||||||
// struct Parent(i32);
|
struct Parent(i32);
|
||||||
// dep!(parent(Parent, Parent));
|
dep!(parent(Parent, (Parent,)));
|
||||||
|
|
||||||
// #[derive(Debug, Clone, Default, State)]
|
#[derive(Debug, Clone, Default, State)]
|
||||||
// struct StateTester {
|
struct StateTester {
|
||||||
// #[node_dep_state((child, parent))]
|
#[node_dep_state((child, parent))]
|
||||||
// node: Node,
|
node: Node,
|
||||||
// #[child_dep_state(child)]
|
#[child_dep_state(child)]
|
||||||
// child: Child,
|
child: Child,
|
||||||
// #[parent_dep_state(parent)]
|
#[parent_dep_state(parent)]
|
||||||
// parent: Parent,
|
parent: Parent,
|
||||||
// }
|
}
|
||||||
|
|
||||||
// test_state!(StateTester, child: (child), node: (node), parent: (parent));
|
// test_state!(StateTester, child: (child), node: (node), parent: (parent));
|
||||||
// }
|
}
|
||||||
|
|
||||||
// mod child_depends_on_node_that_depends_on_parent {
|
// mod child_depends_on_node_that_depends_on_parent {
|
||||||
// use super::*;
|
// use super::*;
|
||||||
// #[derive(Debug, Clone, Default, PartialEq)]
|
// #[derive(Debug, Clone, Default, PartialEq)]
|
||||||
// struct Node(i32);
|
// struct Node(i32);
|
||||||
// dep!(node(Node, (&'a Parent,)));
|
// dep!(node(Node, (Parent,)));
|
||||||
|
|
||||||
// #[derive(Debug, Clone, Default, PartialEq)]
|
// #[derive(Debug, Clone, Default, PartialEq)]
|
||||||
// struct Child(i32);
|
// struct Child(i32);
|
||||||
// dep!(child(Child, Node));
|
// dep!(child(Child, (Node,)));
|
||||||
|
|
||||||
// #[derive(Debug, Clone, Default, PartialEq)]
|
// #[derive(Debug, Clone, Default, PartialEq)]
|
||||||
// struct Parent(i32);
|
// struct Parent(i32);
|
||||||
// dep!(parent(Parent, Parent));
|
// dep!(parent(Parent, (Parent,)));
|
||||||
|
|
||||||
// #[derive(Debug, Clone, Default, State)]
|
// #[derive(Debug, Clone, Default, State)]
|
||||||
// struct StateTester {
|
// struct StateTester {
|
||||||
@@ -174,15 +187,15 @@
|
|||||||
// use super::*;
|
// use super::*;
|
||||||
// #[derive(Debug, Clone, Default, PartialEq)]
|
// #[derive(Debug, Clone, Default, PartialEq)]
|
||||||
// struct Node(i32);
|
// struct Node(i32);
|
||||||
// dep!(node(Node, (&'a Child,)));
|
// dep!(node(Node, (Child,)));
|
||||||
|
|
||||||
// #[derive(Debug, Clone, Default, PartialEq)]
|
// #[derive(Debug, Clone, Default, PartialEq)]
|
||||||
// struct Child(i32);
|
// struct Child(i32);
|
||||||
// dep!(child(Child, Child));
|
// dep!(child(Child, (Child,)));
|
||||||
|
|
||||||
// #[derive(Debug, Clone, Default, PartialEq)]
|
// #[derive(Debug, Clone, Default, PartialEq)]
|
||||||
// struct Parent(i32);
|
// struct Parent(i32);
|
||||||
// dep!(parent(Parent, Node));
|
// dep!(parent(Parent, (Node,)));
|
||||||
|
|
||||||
// #[derive(Debug, Clone, Default, State)]
|
// #[derive(Debug, Clone, Default, State)]
|
||||||
// struct StateTester {
|
// struct StateTester {
|
||||||
@@ -201,7 +214,7 @@
|
|||||||
// use super::*;
|
// use super::*;
|
||||||
// #[derive(Debug, Clone, Default, PartialEq)]
|
// #[derive(Debug, Clone, Default, PartialEq)]
|
||||||
// struct Node1(i32);
|
// struct Node1(i32);
|
||||||
// dep!(node(Node1, (&'a Node2,)));
|
// dep!(node(Node1, (Node2,)));
|
||||||
|
|
||||||
// #[derive(Debug, Clone, Default, PartialEq)]
|
// #[derive(Debug, Clone, Default, PartialEq)]
|
||||||
// struct Node2(i32);
|
// struct Node2(i32);
|
||||||
@@ -226,11 +239,11 @@
|
|||||||
|
|
||||||
// #[derive(Debug, Clone, Default, PartialEq)]
|
// #[derive(Debug, Clone, Default, PartialEq)]
|
||||||
// struct Child(i32);
|
// struct Child(i32);
|
||||||
// dep!(child(Child, Child));
|
// dep!(child(Child, (Child,)));
|
||||||
|
|
||||||
// #[derive(Debug, Clone, Default, PartialEq)]
|
// #[derive(Debug, Clone, Default, PartialEq)]
|
||||||
// struct Parent(i32);
|
// struct Parent(i32);
|
||||||
// dep!(parent(Parent, Parent));
|
// dep!(parent(Parent, (Parent,)));
|
||||||
|
|
||||||
// #[derive(Debug, Clone, Default, State)]
|
// #[derive(Debug, Clone, Default, State)]
|
||||||
// struct StateTester {
|
// struct StateTester {
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
use std::hash::BuildHasherDefault;
|
use std::hash::BuildHasherDefault;
|
||||||
|
|
||||||
pub use node_ref::NodeMask;
|
pub use node_ref::NodeMask;
|
||||||
pub use passes::AnyPass;
|
pub use passes::{
|
||||||
|
AnyPass, DownwardPass, MemberMask, NodePass, Pass, PassId, PassReturn, UpwardPass,
|
||||||
|
};
|
||||||
use rustc_hash::FxHasher;
|
use rustc_hash::FxHasher;
|
||||||
pub use tree::NodeId;
|
pub use tree::NodeId;
|
||||||
|
|
||||||
@@ -18,7 +20,7 @@ pub mod utils;
|
|||||||
pub type RealNodeId = NodeId;
|
pub type RealNodeId = NodeId;
|
||||||
pub(crate) type FxDashMap<K, V> = dashmap::DashMap<K, V, BuildHasherDefault<FxHasher>>;
|
pub(crate) type FxDashMap<K, V> = dashmap::DashMap<K, V, BuildHasherDefault<FxHasher>>;
|
||||||
pub(crate) type FxDashSet<K> = dashmap::DashSet<K, BuildHasherDefault<FxHasher>>;
|
pub(crate) type FxDashSet<K> = dashmap::DashSet<K, BuildHasherDefault<FxHasher>>;
|
||||||
pub(crate) type SendAnyMap = anymap::Map<dyn anymap::any::Any + Send + Sync + 'static>;
|
pub type SendAnyMap = anymap::Map<dyn anymap::any::Any + Send + Sync + 'static>;
|
||||||
|
|
||||||
/// Used in derived state macros
|
/// Used in derived state macros
|
||||||
#[derive(Eq, PartialEq)]
|
#[derive(Eq, PartialEq)]
|
||||||
|
|||||||
@@ -111,10 +111,10 @@ impl DirtyNodeStates {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, PartialOrd, Ord)]
|
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, PartialOrd, Ord)]
|
||||||
pub struct PassId(u64);
|
pub struct PassId(pub u64);
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Default)]
|
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy, Default)]
|
||||||
pub struct MemberMask(u64);
|
pub struct MemberMask(pub u64);
|
||||||
|
|
||||||
impl MemberMask {
|
impl MemberMask {
|
||||||
pub fn overlaps(&self, other: Self) -> bool {
|
pub fn overlaps(&self, other: Self) -> bool {
|
||||||
|
|||||||
Reference in new issue
Block a user