Fix formatting of previous commit

This commit is contained in:
Keavon Chambers 2022-08-04 00:18:42 -07:00
parent d09f023618
commit 0c2dbd411b
11 changed files with 226 additions and 234 deletions

View File

@ -2,7 +2,7 @@
name = "dyn-any" name = "dyn-any"
version = "0.2.1" version = "0.2.1"
edition = "2021" edition = "2021"
authors = ["Dennis Kobert <dennis@kobert.dev>"] authors = ["Graphite Authors <contact@graphite.rs>"]
description = "An Any trait that works for arbitrary lifetimes" description = "An Any trait that works for arbitrary lifetimes"

View File

@ -2,7 +2,7 @@
name = "dyn-any-derive" name = "dyn-any-derive"
version = "0.2.1" version = "0.2.1"
edition = "2021" edition = "2021"
authors = ["Dennis Kobert"] authors = ["Graphite Authors <contact@graphite.rs>"]
description = "#[derive(DynAny<'a>)]" description = "#[derive(DynAny<'a>)]"
documentation = "https://docs.rs/dyn-any-derive" documentation = "https://docs.rs/dyn-any-derive"

View File

@ -3,7 +3,7 @@ name = "graphene-core"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
description = "API definitions for Graphene" description = "API definitions for Graphene"
authors = ["Dennis Kobert <dennis@kobert.dev>"] authors = ["Graphite Authors <contact@graphite.rs>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -9,8 +9,7 @@ pub struct ComposeNode<'n, Inter, First, Second> {
_phantom2: PhantomData<Inter>, _phantom2: PhantomData<Inter>,
} }
impl<'n, Input: 'n, Inter: 'n, First, Second> Node<'n, Input> impl<'n, Input: 'n, Inter: 'n, First, Second> Node<'n, Input> for ComposeNode<'n, Input, Inter, First, Second>
for ComposeNode<'n, Input, Inter, First, Second>
where where
First: Node<'n, Input, Output = Inter>, First: Node<'n, Input, Output = Inter>,
Second: Node<'n, Inter>, /*+ Node<<First as Node<Input>>::Output<'n>>*/ Second: Node<'n, Inter>, /*+ Node<<First as Node<Input>>::Output<'n>>*/
@ -48,8 +47,7 @@ pub struct ComposeNodeOwned<'n, Input, Inter, FIRST, SECOND> {
_phantom2: PhantomData<Inter>, _phantom2: PhantomData<Inter>,
} }
impl<'n, Input: 'n, Inter: 'n, First, Second> Node<'n, Input> impl<'n, Input: 'n, Inter: 'n, First, Second> Node<'n, Input> for ComposeNodeOwned<'n, Input, Inter, First, Second>
for ComposeNodeOwned<'n, Input, Inter, First, Second>
where where
First: Node<'n, Input, Output = Inter>, First: Node<'n, Input, Output = Inter>,
Second: Node<'n, Inter>, Second: Node<'n, Inter>,
@ -90,10 +88,7 @@ where
} }
pub trait After<I>: Sized { pub trait After<I>: Sized {
fn after<'n, First: Node<'n, I>>( fn after<'n, First: Node<'n, I>>(&'n self, first: &'n First) -> ComposeNode<'n, I, <First as Node<'n, I>>::Output, First, Self> {
&'n self,
first: &'n First,
) -> ComposeNode<'n, I, <First as Node<'n, I>>::Output, First, Self> {
ComposeNode::new(first, self) ComposeNode::new(first, self)
} }
} }

View File

@ -3,7 +3,7 @@ name = "graphene-std"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
description = "Graphene standard library" description = "Graphene standard library"
authors = ["Dennis Kobert <dennis@kobert.dev>"] authors = ["Graphite Authors <contact@graphite.rs>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -30,8 +30,7 @@ where
input.borrow().hash(&mut hasher); input.borrow().hash(&mut hasher);
let hash = hasher.finish(); let hash = hasher.finish();
self.map self.map.get_or_create_with(&hash, || CacheNode::new(self.node))
.get_or_create_with(&hash, || CacheNode::new(self.node))
} }
} }
@ -40,9 +39,6 @@ impl<'n, 'c, NODE: Node> SmartCacheNode<'n, 'c, NODE> {
self.map = StorageMap::default(); self.map = StorageMap::default();
} }
pub fn new(node: &'n NODE) -> SmartCacheNode<'n, 'c, NODE> { pub fn new(node: &'n NODE) -> SmartCacheNode<'n, 'c, NODE> {
SmartCacheNode { SmartCacheNode { node, map: StorageMap::default() }
node,
map: StorageMap::default(),
}
} }
} }

View File

@ -1,7 +1,7 @@
[package] [package]
name = "graph-proc-macros" name = "graph-proc-macros"
version = "0.1.0" version = "0.1.0"
authors = ["Dennis Kobert <dennis@kobert.dev>"] authors = ["Graphite Authors <contact@graphite.rs>"]
edition = "2021" edition = "2021"
publish = false publish = false

View File

@ -31,6 +31,7 @@ pub fn to_node(_attr: TokenStream, item: TokenStream) -> TokenStream {
let string = item.to_string(); let string = item.to_string();
let item2 = item; let item2 = item;
let parsed = parse_macro_input!(item2 as ItemFn); // 3 let parsed = parse_macro_input!(item2 as ItemFn); // 3
//item.extend(generate_to_string(parsed, string)); // 4 //item.extend(generate_to_string(parsed, string)); // 4
//item //item
generate_to_string(parsed, string) generate_to_string(parsed, string)
@ -40,6 +41,7 @@ fn generate_to_string(parsed: ItemFn, string: String) -> TokenStream {
let whole_function = parsed.clone(); let whole_function = parsed.clone();
//let fn_body = parsed.block; // function body //let fn_body = parsed.block; // function body
let sig = parsed.sig; // function signature let sig = parsed.sig; // function signature
//let vis = parsed.vis; // visibility, pub or not //let vis = parsed.vis; // visibility, pub or not
let generics = sig.generics; let generics = sig.generics;
let fn_args = sig.inputs; // comma separated args let fn_args = sig.inputs; // comma separated args
@ -90,7 +92,6 @@ fn generate_to_string(parsed: ItemFn, string: String) -> TokenStream {
position: (0., 0.), position: (0., 0.),
} }
} }
}; };
//panic!("{}\n{:?}", x.to_string(), x); //panic!("{}\n{:?}", x.to_string(), x);
x.into() x.into()