From 800fb4dbc1e9d22fae38feffb421179a279f3daf Mon Sep 17 00:00:00 2001 From: Dennis Date: Sat, 2 Apr 2022 14:50:00 +0200 Subject: [PATCH] Restructure node graph project layout --- node-graph/Cargo.lock | 512 ++++--- node-graph/Cargo.toml | 24 +- node-graph/gcore/Cargo.toml | 10 + node-graph/{src/main.rs => gcore/src/lib.rs} | 37 - node-graph/gstd/Cargo.lock | 1319 ++++++++++++++++++ node-graph/gstd/Cargo.toml | 25 + node-graph/gstd/src/cache.rs | 48 + node-graph/gstd/src/generic.rs | 39 + node-graph/gstd/src/lib.rs | 10 + node-graph/gstd/src/main.rs | 13 + node-graph/gstd/src/memo.rs | 28 + node-graph/gstd/src/ops.rs | 37 + node-graph/gstd/src/structural.rs | 60 + node-graph/gstd/src/value.rs | 38 + node-graph/proc-macro/Cargo.lock | 26 +- node-graph/proc-macro/Cargo.toml | 8 +- node-graph/proc-macro/src/lib.rs | 15 +- node-graph/src/iter.rs | 38 - node-graph/src/nodes.rs | 269 ---- 19 files changed, 1958 insertions(+), 598 deletions(-) create mode 100644 node-graph/gcore/Cargo.toml rename node-graph/{src/main.rs => gcore/src/lib.rs} (57%) create mode 100644 node-graph/gstd/Cargo.lock create mode 100644 node-graph/gstd/Cargo.toml create mode 100644 node-graph/gstd/src/cache.rs create mode 100644 node-graph/gstd/src/generic.rs create mode 100644 node-graph/gstd/src/lib.rs create mode 100644 node-graph/gstd/src/main.rs create mode 100644 node-graph/gstd/src/memo.rs create mode 100644 node-graph/gstd/src/ops.rs create mode 100644 node-graph/gstd/src/structural.rs create mode 100644 node-graph/gstd/src/value.rs delete mode 100644 node-graph/src/iter.rs delete mode 100644 node-graph/src/nodes.rs diff --git a/node-graph/Cargo.lock b/node-graph/Cargo.lock index 7b605df37..0a495403e 100644 --- a/node-graph/Cargo.lock +++ b/node-graph/Cargo.lock @@ -19,21 +19,21 @@ checksum = "33954243bd79057c2de7338850b85983a44588021f8a5fee574a8888c6de4344" [[package]] name = "arrayvec" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4dc07131ffa69b8072d35f5007352af944213cde02545e2103680baed38fcd" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "autocfg" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "cfg-if" @@ -43,9 +43,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chalk-derive" -version = "0.68.0" +version = "0.81.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1552e7666a857f5417e6051ce705ea6856ab2cda39be7605e5b626fa47416b" +checksum = "0bb2ca8aa9da8210effebb51e49b4bd8bc25c06df38220d58a60df35a08a84af" dependencies = [ "proc-macro2", "quote", @@ -55,9 +55,9 @@ dependencies = [ [[package]] name = "chalk-ir" -version = "0.68.0" +version = "0.81.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d7d5f1448dbac493541e97221f7f4c32326c4c76c6ecf543daf72a1dd93e66" +checksum = "e128fa3652ef2cdd5a7e64e0cc5a89f40170f80dd9f6357ba4a82cf027abd0d5" dependencies = [ "bitflags", "chalk-derive", @@ -66,9 +66,9 @@ dependencies = [ [[package]] name = "chalk-recursive" -version = "0.68.0" +version = "0.81.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0df406d2927321021b48acd193459dd33c913732155c93442d03f5ae8275385" +checksum = "ea6fcba1e8b66a291430b6aa18368a95da0577d7f126653baae71c0cb0f3d093" dependencies = [ "chalk-derive", "chalk-ir", @@ -79,13 +79,14 @@ dependencies = [ [[package]] name = "chalk-solve" -version = "0.68.0" +version = "0.81.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cbfcd5daa5ab8b1c9e5e10e83b0ac26271480f6ae5b5f35e5b19e1f6a0e6e37" +checksum = "43151ddc627d8dfbde6af44405cb8e98a15828f66a3d4a3da6a1fad6c5dc4687" dependencies = [ "chalk-derive", "chalk-ir", "ena", + "indexmap", "itertools", "petgraph", "rustc-hash", @@ -94,11 +95,11 @@ dependencies = [ [[package]] name = "countme" -version = "2.0.4" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "328b822bdcba4d4e402be8d9adb6eebf269f969f8eadef977a553ff3c4fbcb58" +checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" dependencies = [ - "dashmap 4.0.2", + "dashmap", "once_cell", "rustc-hash", ] @@ -111,9 +112,9 @@ checksum = "0d48d8f76bd9331f19fe2aaf3821a9f9fb32c3963e1e3d6ce82a8c09cef7444a" [[package]] name = "crossbeam-channel" -version = "0.5.1" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" dependencies = [ "cfg-if", "crossbeam-utils", @@ -121,9 +122,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -132,10 +133,11 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.5" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" dependencies = [ + "autocfg", "cfg-if", "crossbeam-utils", "lazy_static", @@ -145,24 +147,14 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" dependencies = [ "cfg-if", "lazy_static", ] -[[package]] -name = "dashmap" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" -dependencies = [ - "cfg-if", - "num_cpus", -] - [[package]] name = "dashmap" version = "5.2.0" @@ -176,9 +168,9 @@ dependencies = [ [[package]] name = "dissimilar" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc4b29f4b9bb94bf267d57269fd0706d343a160937108e9619fe380645428abb" +checksum = "31ad93652f40969dead8d4bf897a41e9462095152eb21c56e5830537e41179dd" [[package]] name = "dot" @@ -233,17 +225,43 @@ checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a" name = "graph-proc-macros" version = "0.1.0" dependencies = [ + "graphene-core", "proc-macro2", + "proc_macro_roids", "quote", "syn", ] +[[package]] +name = "graphene-core" +version = "0.1.0" + +[[package]] +name = "graphene-std" +version = "0.1.0" +dependencies = [ + "graph-proc-macros", + "graphene-core", + "lock_api", + "once_cell", + "parking_lot 0.12.0", + "ra_ap_ide", + "ra_ap_ide_db", + "storage-map", +] + [[package]] name = "hashbrown" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +[[package]] +name = "hashbrown" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c21d40587b92fa6a6c6e3c1bdbf87d75511db5672f9c93175574b3a00df1758" + [[package]] name = "heck" version = "0.3.3" @@ -275,28 +293,28 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" +checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.11.2", ] [[package]] name = "instant" -version = "0.1.9" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if", ] [[package]] name = "itertools" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" dependencies = [ "either", ] @@ -309,70 +327,57 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.97" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" +checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" [[package]] name = "lock_api" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ + "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.14" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" dependencies = [ "cfg-if", ] [[package]] name = "matches" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "memchr" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memoffset" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] [[package]] name = "miow" -version = "0.3.7" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +checksum = "a7377f7792b3afb6a3cba68daa54ca23c032137010460d667fda53a8d66be00e" dependencies = [ - "winapi", -] - -[[package]] -name = "nodegraph-experiments" -version = "0.1.0" -dependencies = [ - "dashmap 5.2.0", - "graph-proc-macros", - "lock_api", - "once_cell", - "parking_lot 0.11.1", - "ra_ap_ide", - "ra_ap_ide_db", - "storage-map", + "windows-sys 0.28.0", ] [[package]] @@ -399,13 +404,13 @@ checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "parking_lot" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core 0.8.3", + "parking_lot_core 0.8.5", ] [[package]] @@ -415,14 +420,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" dependencies = [ "lock_api", - "parking_lot_core 0.9.1", + "parking_lot_core 0.9.2", ] [[package]] name = "parking_lot_core" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ "cfg-if", "instant", @@ -434,15 +439,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" +checksum = "995f667a6c822200b0433ac218e05582f0e2efa1b922a3fd2fbaadc5f87bab37" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.34.0", ] [[package]] @@ -482,24 +487,35 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" +checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" [[package]] name = "proc-macro2" -version = "1.0.27" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" dependencies = [ "unicode-xid", ] [[package]] -name = "pulldown-cmark" -version = "0.8.0" +name = "proc_macro_roids" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8" +checksum = "06675fa2c577f52bcf77fbb511123927547d154faa08097cc012c66ec3c9611a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pulldown-cmark" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34f197a544b0c9ab3ae46c359a7ec9cbbb5c7bf97054266fecb7ead794a181d6" dependencies = [ "bitflags", "memchr", @@ -508,27 +524,27 @@ dependencies = [ [[package]] name = "pulldown-cmark-to-cmark" -version = "6.0.2" +version = "10.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95048382115a9da7be92ad51c84064d585b7da17472dcaa7f5eed8853c4c3707" +checksum = "3eafb76310f7dc895b5d83d24f2a00e244fc8a68ef94f4257eb4060984d0385f" dependencies = [ "pulldown-cmark", ] [[package]] name = "quote" -version = "1.0.9" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" dependencies = [ "proc-macro2", ] [[package]] name = "ra_ap_base_db" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad75dcbf16655060d015faee5c607e8f943692f12c7b9102d405081e42aad393" +checksum = "c2f5a91abfe1bd64ec51cf9c587f652f4317a347cc1242e2485abb95004ce27b" dependencies = [ "ra_ap_cfg", "ra_ap_profile", @@ -543,9 +559,9 @@ dependencies = [ [[package]] name = "ra_ap_cfg" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45095a712964fe8293f5f535b72f6acbdb004b602e75c10554842c9483b2d35b" +checksum = "02c3279764c5318ea19cf3703d222a06bf20239ff9124e59529ab46d5b26c492" dependencies = [ "ra_ap_tt", "rustc-hash", @@ -553,14 +569,13 @@ dependencies = [ [[package]] name = "ra_ap_hir" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebf894f290059ab250d159bc979659f85f7e1d9057310782ab867ba27a5de9cf" +checksum = "55bd96cece8703de284b01bfff0893a060b164a8580ab60ced1da233da661234" dependencies = [ "arrayvec", "either", "itertools", - "log", "once_cell", "ra_ap_base_db", "ra_ap_cfg", @@ -577,24 +592,27 @@ dependencies = [ [[package]] name = "ra_ap_hir_def" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a5c4623546813f0c970e72591face7602f88df6cd29c41ac73e9fc8de4f1a9" +checksum = "84cd0ecba89b43000dab55a4c78ede7d676244a6c1ac2439349cf73a15ccc98a" dependencies = [ "anymap", + "arrayvec", "cov-mark", - "dashmap 4.0.2", + "dashmap", "drop_bomb", "either", "fst", "indexmap", "itertools", - "log", + "lock_api", "once_cell", + "parking_lot 0.12.0", "ra_ap_base_db", "ra_ap_cfg", "ra_ap_hir_expand", "ra_ap_la-arena", + "ra_ap_limit", "ra_ap_mbe", "ra_ap_profile", "ra_ap_stdx", @@ -602,32 +620,36 @@ dependencies = [ "ra_ap_tt", "rustc-hash", "smallvec", + "tracing", ] [[package]] name = "ra_ap_hir_expand" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b75f701fd5bb2d75f56740e7640e4a88efb64cfe77a7161e7463dfc8fa2f1fa" +checksum = "063d2fad72fefe5d6d0d5228e37512e10624f20687b6cffd21907cbd56a2b9a7" dependencies = [ + "cov-mark", "either", - "log", + "hashbrown 0.12.0", + "itertools", "ra_ap_base_db", "ra_ap_cfg", "ra_ap_la-arena", + "ra_ap_limit", "ra_ap_mbe", - "ra_ap_parser", "ra_ap_profile", "ra_ap_syntax", "ra_ap_tt", "rustc-hash", + "tracing", ] [[package]] name = "ra_ap_hir_ty" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84432db1634ef0c0ec4af1df22e6a29b4195411c36bc2b499b18268c7c4a61e5" +checksum = "db2ea8975f7c5a6831369c52167706ff4642770a262013fbb375a068c88ad157" dependencies = [ "arrayvec", "chalk-ir", @@ -636,32 +658,33 @@ dependencies = [ "cov-mark", "ena", "itertools", - "log", "once_cell", "ra_ap_base_db", "ra_ap_hir_def", "ra_ap_hir_expand", "ra_ap_la-arena", + "ra_ap_limit", "ra_ap_profile", "ra_ap_stdx", "ra_ap_syntax", "rustc-hash", "scoped-tls", "smallvec", + "tracing", + "typed-arena", ] [[package]] name = "ra_ap_ide" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7708bf39deaf7144e3eb3717d2684e71a4c3f0d5dc5b99d64234328b9350ac5" +checksum = "ecabafedcae3017623470cbd6e5e71a07e526cf651914b1dcd64e337501c6d98" dependencies = [ "cov-mark", + "crossbeam-channel", "dot", "either", - "indexmap", "itertools", - "log", "oorandom", "pulldown-cmark", "pulldown-cmark-to-cmark", @@ -677,14 +700,15 @@ dependencies = [ "ra_ap_syntax", "ra_ap_text_edit", "rustc-hash", + "tracing", "url", ] [[package]] name = "ra_ap_ide_assists" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b774157bfc45644c87927d2267037149a9de8e7d15dcd096c4717e4579afb6f4" +checksum = "fc569e43edf426f469d2496722101ac3e271840a7ec299c9e2d49fa530aceaeb" dependencies = [ "cov-mark", "either", @@ -700,14 +724,13 @@ dependencies = [ [[package]] name = "ra_ap_ide_completion" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d0973fae1d3eae7a033edcc61fe183883ee49b92e78a643840403926f1d8dc" +checksum = "9340b4031f514b23a39a389c425bc79f1bd9bcd10f413ac24bfca933afa83df8" dependencies = [ "cov-mark", "either", "itertools", - "log", "once_cell", "ra_ap_base_db", "ra_ap_hir", @@ -717,35 +740,40 @@ dependencies = [ "ra_ap_syntax", "ra_ap_text_edit", "rustc-hash", + "smallvec", ] [[package]] name = "ra_ap_ide_db" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "199cb7e3fdd036a56d357fc73e8c6345f2d8016911bcb6acaed6e354d79e4a92" +checksum = "33979ee6d0294911b27f418801a3113b2e4e020f622c429fa326bbf497083081" dependencies = [ + "arrayvec", "cov-mark", "either", "fst", + "indexmap", "itertools", - "log", "once_cell", "ra_ap_base_db", "ra_ap_hir", + "ra_ap_limit", + "ra_ap_parser", "ra_ap_profile", "ra_ap_stdx", "ra_ap_syntax", "ra_ap_text_edit", "rayon", "rustc-hash", + "tracing", ] [[package]] name = "ra_ap_ide_diagnostics" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5393acf7e08b2f07f04bbc3589c33d5e84b839cb40a80b3be3ede15244055ee5" +checksum = "54e0e29cffd2c798c02377334fb8533f35d898ac73b7a17d2095ef873bb5cd63" dependencies = [ "cov-mark", "either", @@ -762,14 +790,15 @@ dependencies = [ [[package]] name = "ra_ap_ide_ssr" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "675a51104fb31f33535ad3445b29223b01c86474cfa2d8deed9f94b26db185b2" +checksum = "a560943ffca1b6be3441358fdacb325607686c1659522f140454900cdd0fd5a2" dependencies = [ "cov-mark", "itertools", "ra_ap_hir", "ra_ap_ide_db", + "ra_ap_parser", "ra_ap_syntax", "ra_ap_text_edit", "rustc-hash", @@ -777,46 +806,54 @@ dependencies = [ [[package]] name = "ra_ap_la-arena" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c021212fed9211c9484e29669dbe56badb61aab5b50c43b2369147626ea1fc7" +checksum = "2d0df673783137ac10a561b40c3c724503e4aeefa6e4261df268d2f1b9adc172" + +[[package]] +name = "ra_ap_limit" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6388e66ec2a29941f451e40a17fd27abb12a2d4aac8b9e16d4eb44c294af73" [[package]] name = "ra_ap_mbe" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc9f4463afacc1c9c7f0996a5466cfa157c51afae25223e3da7c2556312eff8f" +checksum = "937c357f1c53f2c341a3f2aff603c4976baca8b3e4510ffd0b7e699a18b39abd" dependencies = [ "cov-mark", - "log", "ra_ap_parser", "ra_ap_stdx", "ra_ap_syntax", "ra_ap_tt", "rustc-hash", "smallvec", + "tracing", ] [[package]] name = "ra_ap_parser" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3798fa72cd25c997af35e0af97fde3d18f3eb9021a5c66f51cf43386149ac8c" +checksum = "c2bef6d2dd2f9b201730c267d351cc886023a96432977f34167d2af22ce0f548" dependencies = [ "drop_bomb", + "ra_ap_limit", + "rustc-ap-rustc_lexer", ] [[package]] name = "ra_ap_paths" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96445253d6f577843a6c290916d0be1c1b13ab415a5b8d6b169f996e24a019a1" +checksum = "2402f2a9e1de2ad354011de217f01529caade82fe1d183a5eaa70c0e65080ed1" [[package]] name = "ra_ap_profile" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82d6035f3193b630f7bffc9a22fbb626975cb73caa9a308916f77f441eeaccc6" +checksum = "a61c3aac011216b345f80754a91f776a72d267d4e8a42c721c62a5959eb4feec" dependencies = [ "cfg-if", "countme", @@ -829,9 +866,9 @@ dependencies = [ [[package]] name = "ra_ap_stdx" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1affd8e72aa957fc9bc9ff840c0c319ae7addf2b30bb0232cc45553bc0ea3138" +checksum = "7f9b01b789b9b41433aa76f10e842edd02640aff4fffc1719dd467b39f3fe10c" dependencies = [ "always-assert", "libc", @@ -841,11 +878,10 @@ dependencies = [ [[package]] name = "ra_ap_syntax" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e9a45ddbd92aae76a2a4b79e7c2246d54d2545a816cbabccdd7cc8f9e30c41c" +checksum = "b88f11a5ee695d7910fbbf87e237ed778b70d0352ce4d23bd0cabe8e3341c797" dependencies = [ - "arrayvec", "cov-mark", "indexmap", "itertools", @@ -857,15 +893,14 @@ dependencies = [ "rowan", "rustc-ap-rustc_lexer", "rustc-hash", - "serde", "smol_str", ] [[package]] name = "ra_ap_test_utils" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721f6b0fceb429c3594accd4f0a0eb5dae8d42328a9fba4bb13c089acfabf106" +checksum = "0705341c7ca5cfa2ce3aa6dbddfe43eb778feccff03ee02a0013bc2759c4e30e" dependencies = [ "dissimilar", "ra_ap_profile", @@ -876,18 +911,19 @@ dependencies = [ [[package]] name = "ra_ap_text_edit" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dc90629006acaff9042011f64b063585f70d8a7e209be8667544543be138362" +checksum = "62c5d159fa498994a62dc7393182251a235815ad6f83cb2efab1563d15446634" dependencies = [ + "itertools", "text-size", ] [[package]] name = "ra_ap_tt" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62388fb1a2ab3e0448e89cc0fe1f90f821079799ba7262a2f482b5f0fdcb3307" +checksum = "8ac5f623794d2fd42ad3409825bb2126509035f9412324558ce59a5df35e1f3e" dependencies = [ "ra_ap_stdx", "smol_str", @@ -895,9 +931,9 @@ dependencies = [ [[package]] name = "ra_ap_vfs" -version = "0.0.63" +version = "0.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99af8a98fe67a3d167fec0c7a32b58c3d834059afd9eb20214f3f0e01503893e" +checksum = "f3ec70fe2d160f2d36131c3469c63d274f30773135772541ab174a6785ca16d4" dependencies = [ "fst", "indexmap", @@ -932,21 +968,21 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" dependencies = [ "bitflags", ] [[package]] name = "rowan" -version = "0.13.0-pre.7" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9a7c0b71a45f8ba80c74d55a7d4b3ec611042d3b98ee56835b6af7b5e9f3f83" +checksum = "a4c1112d7b23c800be3a0dae244886b71d96b1461b57b31b56e4c679acbe614f" dependencies = [ "countme", - "hashbrown", + "hashbrown 0.12.0", "memoffset", "rustc-hash", "text-size", @@ -954,9 +990,9 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_lexer" -version = "721.0.0" +version = "725.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba1f60e2942dc7dc5ea64edeaae01cfba2303871b14936e1af0f54d5420b3d1" +checksum = "f950742ef8a203aa7661aad3ab880438ddeb7f95d4b837c30d65db1a2c5df68e" dependencies = [ "unicode-xid", ] @@ -969,16 +1005,16 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "salsa" -version = "0.17.0-pre.1" +version = "0.17.0-pre.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58038261ea8cd5a7730c4d8c97a22063d7c7eb1c2809e55c3c15f0a5903e5582" +checksum = "9b223dccb46c32753144d0b51290da7230bb4aedcd8379d6b4c9a474c18bf17a" dependencies = [ "crossbeam-utils", "indexmap", "lock_api", "log", "oorandom", - "parking_lot 0.11.1", + "parking_lot 0.11.2", "rustc-hash", "salsa-macros", "smallvec", @@ -986,9 +1022,9 @@ dependencies = [ [[package]] name = "salsa-macros" -version = "0.17.0-pre.1" +version = "0.17.0-pre.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e2fc060627fa5d44bffac98f6089b9497779e2deccc26687f60adc2638e32fb" +checksum = "ac6c2e352df550bf019da7b16164ed2f7fa107c39653d1311d1bba42d1582ff7" dependencies = [ "heck", "proc-macro2", @@ -1010,35 +1046,21 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.126" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.126" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" [[package]] name = "smallvec" -version = "1.6.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" [[package]] name = "smol_str" -version = "0.1.18" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b203e79e90905594272c1c97c7af701533d42adaab0beb3859018e477d54a3b0" +checksum = "61d15c83e300cce35b7c8cd39ff567c1ef42dde6d4a1a38dbdbf9a59902261bd" dependencies = [ "serde", ] @@ -1054,9 +1076,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.73" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" +checksum = "704df27628939572cd88d33f171cd6f896f4eaca85252c6e0a72d8d8287ee86f" dependencies = [ "proc-macro2", "quote", @@ -1065,9 +1087,9 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.12.4" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2", "quote", @@ -1083,9 +1105,9 @@ checksum = "288cb548dbe72b652243ea797201f3d481a0609a967980fcc5b2315ea811560a" [[package]] name = "tinyvec" -version = "1.2.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342" +checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" dependencies = [ "tinyvec_macros", ] @@ -1098,9 +1120,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tracing" -version = "0.1.26" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" +checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" dependencies = [ "cfg-if", "pin-project-lite", @@ -1110,9 +1132,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.15" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2" +checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" dependencies = [ "proc-macro2", "quote", @@ -1121,13 +1143,19 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.18" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" +checksum = "90442985ee2f57c9e1b548ee72ae842f4a9a20e3f417cc38dbc5dc684d9bb4ee" dependencies = [ "lazy_static", ] +[[package]] +name = "typed-arena" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae" + [[package]] name = "unicase" version = "2.6.0" @@ -1139,12 +1167,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" -dependencies = [ - "matches", -] +checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" [[package]] name = "unicode-normalization" @@ -1157,9 +1182,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" [[package]] name = "unicode-xid" @@ -1181,9 +1206,9 @@ dependencies = [ [[package]] name = "version_check" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "winapi" @@ -1209,43 +1234,86 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.32.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6" +checksum = "82ca39602d5cbfa692c4b67e3bcbb2751477355141c1ed434c94da4186836ff6" dependencies = [ - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_msvc", + "windows_aarch64_msvc 0.28.0", + "windows_i686_gnu 0.28.0", + "windows_i686_msvc 0.28.0", + "windows_x86_64_gnu 0.28.0", + "windows_x86_64_msvc 0.28.0", +] + +[[package]] +name = "windows-sys" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5acdd78cb4ba54c0045ac14f62d8f94a03d10047904ae2a40afa1e99d8f70825" +dependencies = [ + "windows_aarch64_msvc 0.34.0", + "windows_i686_gnu 0.34.0", + "windows_i686_msvc 0.34.0", + "windows_x86_64_gnu 0.34.0", + "windows_x86_64_msvc 0.34.0", ] [[package]] name = "windows_aarch64_msvc" -version = "0.32.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" +checksum = "52695a41e536859d5308cc613b4a022261a274390b25bd29dfff4bf08505f3c2" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" [[package]] name = "windows_i686_gnu" -version = "0.32.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" +checksum = "f54725ac23affef038fecb177de6c9bf065787c2f432f79e3c373da92f3e1d8a" + +[[package]] +name = "windows_i686_gnu" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" [[package]] name = "windows_i686_msvc" -version = "0.32.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" +checksum = "51d5158a43cc43623c0729d1ad6647e62fa384a3d135fd15108d37c683461f64" + +[[package]] +name = "windows_i686_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" [[package]] name = "windows_x86_64_gnu" -version = "0.32.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" +checksum = "bc31f409f565611535130cfe7ee8e6655d3fa99c1c61013981e491921b5ce954" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" [[package]] name = "windows_x86_64_msvc" -version = "0.32.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" +checksum = "3f2b8c7cbd3bfdddd9ab98769f9746a7fad1bca236554cd032b78d768bc0e89f" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" diff --git a/node-graph/Cargo.toml b/node-graph/Cargo.toml index 27a8d8a4b..994bae303 100644 --- a/node-graph/Cargo.toml +++ b/node-graph/Cargo.toml @@ -1,19 +1,7 @@ -[package] -name = "nodegraph-experiments" -version = "0.1.0" -edition = "2021" +[workspace] -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[features] -rust_analyzer = ["ide", "ide_db"] - -[dependencies] -ide = { version = "*", package = "ra_ap_ide", optional = true } -ide_db = { version = "*", package = "ra_ap_ide_db" , optional = true } -graph-proc-macros = {path = "proc-macro"} -once_cell = "1.10" -dashmap = "5.2" -storage-map = "*" -lock_api = "*" -parking_lot = "*" +members = [ + "proc-macro", + "gcore", + "gstd", +] diff --git a/node-graph/gcore/Cargo.toml b/node-graph/gcore/Cargo.toml new file mode 100644 index 000000000..487ae7b3d --- /dev/null +++ b/node-graph/gcore/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "graphene-core" +version = "0.1.0" +edition = "2021" +description = "Api definitions for graphene" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + + +[dependencies] diff --git a/node-graph/src/main.rs b/node-graph/gcore/src/lib.rs similarity index 57% rename from node-graph/src/main.rs rename to node-graph/gcore/src/lib.rs index 01063e167..32fffd90c 100644 --- a/node-graph/src/main.rs +++ b/node-graph/gcore/src/lib.rs @@ -1,12 +1,6 @@ #![feature(generic_associated_types)] -//#![deny(rust_2018_idioms)] use std::{any::Any, borrow::Borrow}; -mod iter; -pub mod nodes; -use iter::insert_after_nth; -use nodes::*; - #[rustfmt::skip] pub trait Node { // Self: 'a means that Self has to live at least as long as 'a (the input and output) @@ -39,20 +33,6 @@ impl AnyRef for T { } } -pub trait DefaultNode: Default { - fn default_node() -> ValueNode { - ValueNode::new(Self::default()) - } -} -impl DefaultNode for T {} - -pub trait After: Sized { - fn after<'a, First: Node>(&'a self, first: &'a First) -> ComposeNode<'a, First, Self> { - ComposeNode::new(first, self) - } -} -impl After for Second {} - pub trait Exec: Node where for<'a> &'a (): Borrow<::Input<'a>>, @@ -67,20 +47,3 @@ pub trait DynamicInput { fn set_kwarg_by_name(&mut self, name: &str, value: &dyn Any); fn set_arg_by_index(&mut self, index: usize, value: &dyn Any); } - -fn main() { - let int = IntNode::<32>; - let add: u32 = AddNode::::default().eval((int.exec(), int.exec())); - let fnode = FnNode::new(|(a, b): &(i32, i32)| a - b); - //let sub = fnode.any(&("a", 2)); - let cache = CacheNode::new(&fnode); - let foo = cache.eval(&(2, 3)); - - /* - let curry: CurryNthArgNode<'_, _, _, u32, u32, 0> = CurryNthArgNode::new(&AddNode, &int); - let composition = curry.after(&curry); - let n = ValueNode::new(10_u32); - let curry: CurryNthArgNode<'_, _, _, u32, _, 0> = CurryNthArgNode::new(&composition, &n); - */ - println!("{}", foo) -} diff --git a/node-graph/gstd/Cargo.lock b/node-graph/gstd/Cargo.lock new file mode 100644 index 000000000..eb5dbe64e --- /dev/null +++ b/node-graph/gstd/Cargo.lock @@ -0,0 +1,1319 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "always-assert" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf688625d06217d5b1bb0ea9d9c44a1635fd0ee3534466388d18203174f4d11" +dependencies = [ + "log", +] + +[[package]] +name = "anymap" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33954243bd79057c2de7338850b85983a44588021f8a5fee574a8888c6de4344" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chalk-derive" +version = "0.81.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb2ca8aa9da8210effebb51e49b4bd8bc25c06df38220d58a60df35a08a84af" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "chalk-ir" +version = "0.81.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e128fa3652ef2cdd5a7e64e0cc5a89f40170f80dd9f6357ba4a82cf027abd0d5" +dependencies = [ + "bitflags", + "chalk-derive", + "lazy_static", +] + +[[package]] +name = "chalk-recursive" +version = "0.81.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6fcba1e8b66a291430b6aa18368a95da0577d7f126653baae71c0cb0f3d093" +dependencies = [ + "chalk-derive", + "chalk-ir", + "chalk-solve", + "rustc-hash", + "tracing", +] + +[[package]] +name = "chalk-solve" +version = "0.81.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43151ddc627d8dfbde6af44405cb8e98a15828f66a3d4a3da6a1fad6c5dc4687" +dependencies = [ + "chalk-derive", + "chalk-ir", + "ena", + "indexmap", + "itertools", + "petgraph", + "rustc-hash", + "tracing", +] + +[[package]] +name = "countme" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" +dependencies = [ + "dashmap", + "once_cell", + "rustc-hash", +] + +[[package]] +name = "cov-mark" +version = "2.0.0-pre.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d48d8f76bd9331f19fe2aaf3821a9f9fb32c3963e1e3d6ce82a8c09cef7444a" + +[[package]] +name = "crossbeam-channel" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +dependencies = [ + "cfg-if", + "lazy_static", +] + +[[package]] +name = "dashmap" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8858831f7781322e539ea39e72449c46b059638250c14344fec8d0aa6e539c" +dependencies = [ + "cfg-if", + "num_cpus", + "parking_lot 0.12.0", +] + +[[package]] +name = "dissimilar" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31ad93652f40969dead8d4bf897a41e9462095152eb21c56e5830537e41179dd" + +[[package]] +name = "dot" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a74b6c4d4a1cff5f454164363c16b72fa12463ca6b31f4b5f2035a65fa3d5906" + +[[package]] +name = "drop_bomb" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bda8e21c04aca2ae33ffc2fd8c23134f3cac46db123ba97bd9d3f3b8a4a85e1" + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "ena" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7402b94a93c24e742487327a7cd839dc9d36fec9de9fb25b09f2dae459f36c3" +dependencies = [ + "log", +] + +[[package]] +name = "fixedbitset" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" + +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "fst" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a" + +[[package]] +name = "graph-proc-macros" +version = "0.1.0" +dependencies = [ + "graphene-api", + "proc-macro2", + "proc_macro_roids", + "quote", + "syn", +] + +[[package]] +name = "graphene-api" +version = "0.1.0" + +[[package]] +name = "graphene-std" +version = "0.1.0" +dependencies = [ + "graph-proc-macros", + "graphene-api", + "lock_api", + "once_cell", + "parking_lot 0.12.0", + "ra_ap_ide", + "ra_ap_ide_db", + "storage-map", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" + +[[package]] +name = "hashbrown" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c21d40587b92fa6a6c6e3c1bdbf87d75511db5672f9c93175574b3a00df1758" + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" +dependencies = [ + "autocfg", + "hashbrown 0.11.2", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" + +[[package]] +name = "lock_api" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "matches" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" + +[[package]] +name = "memchr" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "miow" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7377f7792b3afb6a3cba68daa54ca23c032137010460d667fda53a8d66be00e" +dependencies = [ + "windows-sys 0.28.0", +] + +[[package]] +name = "num_cpus" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" + +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.5", +] + +[[package]] +name = "parking_lot" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.2", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "995f667a6c822200b0433ac218e05582f0e2efa1b922a3fd2fbaadc5f87bab37" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys 0.34.0", +] + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "perf-event" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5396562cd2eaa828445d6d34258ae21ee1eb9d40fe626ca7f51c8dccb4af9d66" +dependencies = [ + "libc", + "perf-event-open-sys", +] + +[[package]] +name = "perf-event-open-sys" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce9bedf5da2c234fdf2391ede2b90fabf585355f33100689bc364a3ea558561a" +dependencies = [ + "libc", +] + +[[package]] +name = "petgraph" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" + +[[package]] +name = "proc-macro2" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "proc_macro_roids" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06675fa2c577f52bcf77fbb511123927547d154faa08097cc012c66ec3c9611a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pulldown-cmark" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34f197a544b0c9ab3ae46c359a7ec9cbbb5c7bf97054266fecb7ead794a181d6" +dependencies = [ + "bitflags", + "memchr", + "unicase", +] + +[[package]] +name = "pulldown-cmark-to-cmark" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eafb76310f7dc895b5d83d24f2a00e244fc8a68ef94f4257eb4060984d0385f" +dependencies = [ + "pulldown-cmark", +] + +[[package]] +name = "quote" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "ra_ap_base_db" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2f5a91abfe1bd64ec51cf9c587f652f4317a347cc1242e2485abb95004ce27b" +dependencies = [ + "ra_ap_cfg", + "ra_ap_profile", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_test_utils", + "ra_ap_tt", + "ra_ap_vfs", + "rustc-hash", + "salsa", +] + +[[package]] +name = "ra_ap_cfg" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02c3279764c5318ea19cf3703d222a06bf20239ff9124e59529ab46d5b26c492" +dependencies = [ + "ra_ap_tt", + "rustc-hash", +] + +[[package]] +name = "ra_ap_hir" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55bd96cece8703de284b01bfff0893a060b164a8580ab60ced1da233da661234" +dependencies = [ + "arrayvec", + "either", + "itertools", + "once_cell", + "ra_ap_base_db", + "ra_ap_cfg", + "ra_ap_hir_def", + "ra_ap_hir_expand", + "ra_ap_hir_ty", + "ra_ap_profile", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_tt", + "rustc-hash", + "smallvec", +] + +[[package]] +name = "ra_ap_hir_def" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84cd0ecba89b43000dab55a4c78ede7d676244a6c1ac2439349cf73a15ccc98a" +dependencies = [ + "anymap", + "arrayvec", + "cov-mark", + "dashmap", + "drop_bomb", + "either", + "fst", + "indexmap", + "itertools", + "lock_api", + "once_cell", + "parking_lot 0.12.0", + "ra_ap_base_db", + "ra_ap_cfg", + "ra_ap_hir_expand", + "ra_ap_la-arena", + "ra_ap_limit", + "ra_ap_mbe", + "ra_ap_profile", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_tt", + "rustc-hash", + "smallvec", + "tracing", +] + +[[package]] +name = "ra_ap_hir_expand" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063d2fad72fefe5d6d0d5228e37512e10624f20687b6cffd21907cbd56a2b9a7" +dependencies = [ + "cov-mark", + "either", + "hashbrown 0.12.0", + "itertools", + "ra_ap_base_db", + "ra_ap_cfg", + "ra_ap_la-arena", + "ra_ap_limit", + "ra_ap_mbe", + "ra_ap_profile", + "ra_ap_syntax", + "ra_ap_tt", + "rustc-hash", + "tracing", +] + +[[package]] +name = "ra_ap_hir_ty" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2ea8975f7c5a6831369c52167706ff4642770a262013fbb375a068c88ad157" +dependencies = [ + "arrayvec", + "chalk-ir", + "chalk-recursive", + "chalk-solve", + "cov-mark", + "ena", + "itertools", + "once_cell", + "ra_ap_base_db", + "ra_ap_hir_def", + "ra_ap_hir_expand", + "ra_ap_la-arena", + "ra_ap_limit", + "ra_ap_profile", + "ra_ap_stdx", + "ra_ap_syntax", + "rustc-hash", + "scoped-tls", + "smallvec", + "tracing", + "typed-arena", +] + +[[package]] +name = "ra_ap_ide" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecabafedcae3017623470cbd6e5e71a07e526cf651914b1dcd64e337501c6d98" +dependencies = [ + "cov-mark", + "crossbeam-channel", + "dot", + "either", + "itertools", + "oorandom", + "pulldown-cmark", + "pulldown-cmark-to-cmark", + "ra_ap_cfg", + "ra_ap_hir", + "ra_ap_ide_assists", + "ra_ap_ide_completion", + "ra_ap_ide_db", + "ra_ap_ide_diagnostics", + "ra_ap_ide_ssr", + "ra_ap_profile", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_text_edit", + "rustc-hash", + "tracing", + "url", +] + +[[package]] +name = "ra_ap_ide_assists" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc569e43edf426f469d2496722101ac3e271840a7ec299c9e2d49fa530aceaeb" +dependencies = [ + "cov-mark", + "either", + "itertools", + "ra_ap_hir", + "ra_ap_ide_db", + "ra_ap_profile", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_text_edit", + "rustc-hash", +] + +[[package]] +name = "ra_ap_ide_completion" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9340b4031f514b23a39a389c425bc79f1bd9bcd10f413ac24bfca933afa83df8" +dependencies = [ + "cov-mark", + "either", + "itertools", + "once_cell", + "ra_ap_base_db", + "ra_ap_hir", + "ra_ap_ide_db", + "ra_ap_profile", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_text_edit", + "rustc-hash", + "smallvec", +] + +[[package]] +name = "ra_ap_ide_db" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33979ee6d0294911b27f418801a3113b2e4e020f622c429fa326bbf497083081" +dependencies = [ + "arrayvec", + "cov-mark", + "either", + "fst", + "indexmap", + "itertools", + "once_cell", + "ra_ap_base_db", + "ra_ap_hir", + "ra_ap_limit", + "ra_ap_parser", + "ra_ap_profile", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_text_edit", + "rayon", + "rustc-hash", + "tracing", +] + +[[package]] +name = "ra_ap_ide_diagnostics" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e0e29cffd2c798c02377334fb8533f35d898ac73b7a17d2095ef873bb5cd63" +dependencies = [ + "cov-mark", + "either", + "itertools", + "ra_ap_cfg", + "ra_ap_hir", + "ra_ap_ide_db", + "ra_ap_profile", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_text_edit", + "rustc-hash", +] + +[[package]] +name = "ra_ap_ide_ssr" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a560943ffca1b6be3441358fdacb325607686c1659522f140454900cdd0fd5a2" +dependencies = [ + "cov-mark", + "itertools", + "ra_ap_hir", + "ra_ap_ide_db", + "ra_ap_parser", + "ra_ap_syntax", + "ra_ap_text_edit", + "rustc-hash", +] + +[[package]] +name = "ra_ap_la-arena" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d0df673783137ac10a561b40c3c724503e4aeefa6e4261df268d2f1b9adc172" + +[[package]] +name = "ra_ap_limit" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6388e66ec2a29941f451e40a17fd27abb12a2d4aac8b9e16d4eb44c294af73" + +[[package]] +name = "ra_ap_mbe" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "937c357f1c53f2c341a3f2aff603c4976baca8b3e4510ffd0b7e699a18b39abd" +dependencies = [ + "cov-mark", + "ra_ap_parser", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_tt", + "rustc-hash", + "smallvec", + "tracing", +] + +[[package]] +name = "ra_ap_parser" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2bef6d2dd2f9b201730c267d351cc886023a96432977f34167d2af22ce0f548" +dependencies = [ + "drop_bomb", + "ra_ap_limit", + "rustc-ap-rustc_lexer", +] + +[[package]] +name = "ra_ap_paths" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2402f2a9e1de2ad354011de217f01529caade82fe1d183a5eaa70c0e65080ed1" + +[[package]] +name = "ra_ap_profile" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a61c3aac011216b345f80754a91f776a72d267d4e8a42c721c62a5959eb4feec" +dependencies = [ + "cfg-if", + "countme", + "libc", + "once_cell", + "perf-event", + "ra_ap_la-arena", + "winapi", +] + +[[package]] +name = "ra_ap_stdx" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9b01b789b9b41433aa76f10e842edd02640aff4fffc1719dd467b39f3fe10c" +dependencies = [ + "always-assert", + "libc", + "miow", + "winapi", +] + +[[package]] +name = "ra_ap_syntax" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b88f11a5ee695d7910fbbf87e237ed778b70d0352ce4d23bd0cabe8e3341c797" +dependencies = [ + "cov-mark", + "indexmap", + "itertools", + "once_cell", + "ra_ap_parser", + "ra_ap_profile", + "ra_ap_stdx", + "ra_ap_text_edit", + "rowan", + "rustc-ap-rustc_lexer", + "rustc-hash", + "smol_str", +] + +[[package]] +name = "ra_ap_test_utils" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0705341c7ca5cfa2ce3aa6dbddfe43eb778feccff03ee02a0013bc2759c4e30e" +dependencies = [ + "dissimilar", + "ra_ap_profile", + "ra_ap_stdx", + "rustc-hash", + "text-size", +] + +[[package]] +name = "ra_ap_text_edit" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62c5d159fa498994a62dc7393182251a235815ad6f83cb2efab1563d15446634" +dependencies = [ + "itertools", + "text-size", +] + +[[package]] +name = "ra_ap_tt" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ac5f623794d2fd42ad3409825bb2126509035f9412324558ce59a5df35e1f3e" +dependencies = [ + "ra_ap_stdx", + "smol_str", +] + +[[package]] +name = "ra_ap_vfs" +version = "0.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3ec70fe2d160f2d36131c3469c63d274f30773135772541ab174a6785ca16d4" +dependencies = [ + "fst", + "indexmap", + "ra_ap_paths", + "rustc-hash", +] + +[[package]] +name = "rayon" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +dependencies = [ + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", +] + +[[package]] +name = "redox_syscall" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rowan" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c1112d7b23c800be3a0dae244886b71d96b1461b57b31b56e4c679acbe614f" +dependencies = [ + "countme", + "hashbrown 0.12.0", + "memoffset", + "rustc-hash", + "text-size", +] + +[[package]] +name = "rustc-ap-rustc_lexer" +version = "725.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950742ef8a203aa7661aad3ab880438ddeb7f95d4b837c30d65db1a2c5df68e" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "salsa" +version = "0.17.0-pre.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b223dccb46c32753144d0b51290da7230bb4aedcd8379d6b4c9a474c18bf17a" +dependencies = [ + "crossbeam-utils", + "indexmap", + "lock_api", + "log", + "oorandom", + "parking_lot 0.11.2", + "rustc-hash", + "salsa-macros", + "smallvec", +] + +[[package]] +name = "salsa-macros" +version = "0.17.0-pre.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac6c2e352df550bf019da7b16164ed2f7fa107c39653d1311d1bba42d1582ff7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "serde" +version = "1.0.136" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" + +[[package]] +name = "smallvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" + +[[package]] +name = "smol_str" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61d15c83e300cce35b7c8cd39ff567c1ef42dde6d4a1a38dbdbf9a59902261bd" +dependencies = [ + "serde", +] + +[[package]] +name = "storage-map" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418bb14643aa55a7841d5303f72cf512cfb323b8cc221d51580500a1ca75206c" +dependencies = [ + "lock_api", +] + +[[package]] +name = "syn" +version = "1.0.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704df27628939572cd88d33f171cd6f896f4eaca85252c6e0a72d8d8287ee86f" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "text-size" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "288cb548dbe72b652243ea797201f3d481a0609a967980fcc5b2315ea811560a" + +[[package]] +name = "tinyvec" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tracing" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90442985ee2f57c9e1b548ee72ae842f4a9a20e3f417cc38dbc5dc684d9bb4ee" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "typed-arena" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae" + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" + +[[package]] +name = "unicode-normalization" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", +] + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82ca39602d5cbfa692c4b67e3bcbb2751477355141c1ed434c94da4186836ff6" +dependencies = [ + "windows_aarch64_msvc 0.28.0", + "windows_i686_gnu 0.28.0", + "windows_i686_msvc 0.28.0", + "windows_x86_64_gnu 0.28.0", + "windows_x86_64_msvc 0.28.0", +] + +[[package]] +name = "windows-sys" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5acdd78cb4ba54c0045ac14f62d8f94a03d10047904ae2a40afa1e99d8f70825" +dependencies = [ + "windows_aarch64_msvc 0.34.0", + "windows_i686_gnu 0.34.0", + "windows_i686_msvc 0.34.0", + "windows_x86_64_gnu 0.34.0", + "windows_x86_64_msvc 0.34.0", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52695a41e536859d5308cc613b4a022261a274390b25bd29dfff4bf08505f3c2" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" + +[[package]] +name = "windows_i686_gnu" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f54725ac23affef038fecb177de6c9bf065787c2f432f79e3c373da92f3e1d8a" + +[[package]] +name = "windows_i686_gnu" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" + +[[package]] +name = "windows_i686_msvc" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d5158a43cc43623c0729d1ad6647e62fa384a3d135fd15108d37c683461f64" + +[[package]] +name = "windows_i686_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc31f409f565611535130cfe7ee8e6655d3fa99c1c61013981e491921b5ce954" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f2b8c7cbd3bfdddd9ab98769f9746a7fad1bca236554cd032b78d768bc0e89f" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" diff --git a/node-graph/gstd/Cargo.toml b/node-graph/gstd/Cargo.toml new file mode 100644 index 000000000..004cc0171 --- /dev/null +++ b/node-graph/gstd/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "graphene-std" +version = "0.1.0" +edition = "2021" +description = "Graphene standard library" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[features] +rust_analyzer = ["ide", "ide_db"] +caching = ["storage-map", "lock_api", "parking_lot"] +derive = ["graph-proc-macros"] +memoization = ["once_cell"] +default = ["derive", "memoization"] + + +[dependencies] +graphene-core = {path = "../gcore"} +graph-proc-macros = {path = "../proc-macro", optional = true} +once_cell = {version= "1.10", optional = true} +ide = { version = "*", package = "ra_ap_ide", optional = true } +ide_db = { version = "*", package = "ra_ap_ide_db" , optional = true } +storage-map = { version = "*", optional = true } +lock_api = { version= "*", optional = true } +parking_lot = { version = "*", optional = true } diff --git a/node-graph/gstd/src/cache.rs b/node-graph/gstd/src/cache.rs new file mode 100644 index 000000000..680b65731 --- /dev/null +++ b/node-graph/gstd/src/cache.rs @@ -0,0 +1,48 @@ +use parking_lot::RawRwLock; +use std::{ + any::Any, + borrow::Borrow, + cell::RefCell, + collections::{hash_map::DefaultHasher, HashMap}, + hash::{Hash, Hasher}, + iter, + iter::Sum, + marker::PhantomData, +}; +use storage_map::{StorageMap, StorageMapGuard}; + +use graphene_api::{DynamicInput, Node}; + +/// Caches the output of a given Node and acts as a proxy +/// Automatically resets if it receives different input +pub struct SmartCacheNode<'n, 'c, NODE: Node + 'c> { + node: &'n NODE, + map: StorageMap>>, +} +impl<'n: 'c, 'c, NODE: Node + 'c> Node for SmartCacheNode<'n, 'c, NODE> +where + for<'a> NODE::Input<'a>: Hash, +{ + type Input<'a> = NODE::Input<'a> where Self: 'a, 'c : 'a; + type Output<'a> = StorageMapGuard<'a, RawRwLock, CacheNode<'n, 'c, NODE>> where Self: 'a, 'c: 'a; + fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { + let mut hasher = DefaultHasher::new(); + input.borrow().hash(&mut hasher); + let hash = hasher.finish(); + + self.map + .get_or_create_with(&hash, || CacheNode::new(self.node)) + } +} + +impl<'n, 'c, NODE: Node> SmartCacheNode<'n, 'c, NODE> { + pub fn clear(&'n mut self) { + self.map = StorageMap::default(); + } + pub fn new(node: &'n NODE) -> SmartCacheNode<'n, 'c, NODE> { + SmartCacheNode { + node, + map: StorageMap::default(), + } + } +} diff --git a/node-graph/gstd/src/generic.rs b/node-graph/gstd/src/generic.rs new file mode 100644 index 000000000..9ce57c5b0 --- /dev/null +++ b/node-graph/gstd/src/generic.rs @@ -0,0 +1,39 @@ +use std::{borrow::Borrow, marker::PhantomData}; + +use graphene_core::Node; +pub struct FnNode O, In, O>(T, PhantomData, PhantomData); +impl O, In, O> Node for FnNode { + type Output<'a> = O where Self: 'a; + type Input<'a> = In where Self: 'a; + + fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { + self.0(input.borrow()) + } +} + +impl O, In, O> FnNode { + pub fn new(f: T) -> Self { + FnNode(f, PhantomData::default(), PhantomData::default()) + } +} + +pub struct FnNodeWithState O, In, O, State>( + T, + State, + PhantomData, + PhantomData, +); +impl O, In, O, State> Node for FnNodeWithState { + type Output<'a> = O where Self: 'a; + type Input<'a> = In where Self: 'a; + + fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { + self.0(input.borrow(), &self.1) + } +} + +impl O, In, O, State> FnNodeWithState { + pub fn new(f: T, state: State) -> Self { + FnNodeWithState(f, state, PhantomData::default(), PhantomData::default()) + } +} diff --git a/node-graph/gstd/src/lib.rs b/node-graph/gstd/src/lib.rs new file mode 100644 index 000000000..699325d63 --- /dev/null +++ b/node-graph/gstd/src/lib.rs @@ -0,0 +1,10 @@ +#![feature(generic_associated_types)] + +#[cfg(feature = "caching")] +pub mod caching; +pub mod generic; +#[cfg(feature = "memoization")] +pub mod memo; +pub mod ops; +pub mod structural; +pub mod value; diff --git a/node-graph/gstd/src/main.rs b/node-graph/gstd/src/main.rs new file mode 100644 index 000000000..a77c556a8 --- /dev/null +++ b/node-graph/gstd/src/main.rs @@ -0,0 +1,13 @@ +use graphene_core::{Exec, Node}; +use graphene_std::*; + +fn main() { + let int = value::IntNode::<32>; + let _add: u32 = ops::AddNode::::default().eval((int.exec(), int.exec())); + let fnode = generic::FnNode::new(|(a, b): &(i32, i32)| a - b); + //let sub = fnode.any(&("a", 2)); + let cache = memo::CacheNode::new(&fnode); + let cached_result = cache.eval(&(2, 3)); + + println!("{}", cached_result) +} diff --git a/node-graph/gstd/src/memo.rs b/node-graph/gstd/src/memo.rs new file mode 100644 index 000000000..254b04a66 --- /dev/null +++ b/node-graph/gstd/src/memo.rs @@ -0,0 +1,28 @@ +use graphene_core::Node; +use once_cell::sync::OnceCell; +use std::borrow::Borrow; + +/// Caches the output of a given Node and acts as a proxy +pub struct CacheNode<'n, 'c, CachedNode: Node + 'c> { + node: &'n CachedNode, + cache: OnceCell>, +} +impl<'n: 'c, 'c, CashedNode: Node> Node for CacheNode<'n, 'c, CashedNode> { + type Output<'a> = &'a CashedNode::Output<'c> where 'c: 'a; + type Input<'a> = CashedNode::Input<'c> where 'c: 'a; + fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { + self.cache.get_or_init(|| self.node.eval(input)) + } +} + +impl<'n, 'c, CachedNode: Node> CacheNode<'n, 'c, CachedNode> { + pub fn clear(&'n mut self) { + self.cache = OnceCell::new(); + } + pub fn new(node: &'n CachedNode) -> CacheNode<'n, 'c, CachedNode> { + CacheNode { + node, + cache: OnceCell::new(), + } + } +} diff --git a/node-graph/gstd/src/ops.rs b/node-graph/gstd/src/ops.rs new file mode 100644 index 000000000..29fa1dfb8 --- /dev/null +++ b/node-graph/gstd/src/ops.rs @@ -0,0 +1,37 @@ +use std::{borrow::Borrow, marker::PhantomData}; + +use graphene_core::Node; + +#[derive(Default)] +pub struct AddNode(PhantomData); +impl Node for AddNode { + type Output<'a> = ::Output; + type Input<'a> = (T, T); + fn eval<'a, I: Borrow>>(&'a self, input: I) -> T::Output { + input.borrow().0 + input.borrow().1 + } +} + +#[derive(Default)] +/// Destructures a Tuple of two values and returns the first one +pub struct FstNode(PhantomData, PhantomData); +impl Node for FstNode { + type Output<'a> = &'a T where Self: 'a; + type Input<'a> = &'a (T, U) where Self: 'a; + fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { + let &(ref a, _) = input.borrow(); + a + } +} + +#[derive(Default)] +/// Destructures a Tuple of two values and returns the first one +pub struct SndNode(PhantomData, PhantomData); +impl Node for SndNode { + type Output<'a> = &'a U where Self: 'a; + type Input<'a> = &'a (T, U) where Self: 'a; + fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { + let &(_, ref b) = input.borrow(); + b + } +} diff --git a/node-graph/gstd/src/structural.rs b/node-graph/gstd/src/structural.rs new file mode 100644 index 000000000..8b98ed16a --- /dev/null +++ b/node-graph/gstd/src/structural.rs @@ -0,0 +1,60 @@ +use std::{any::Any, borrow::Borrow}; + +use graphene_core::{DynamicInput, Node}; +pub struct ComposeNode<'n, FIRST, SECOND> { + first: &'n FIRST, + second: &'n SECOND, +} + +impl<'n, FIRST, SECOND> Node for ComposeNode<'n, FIRST, SECOND> +where + FIRST: Node, + SECOND: Node, + for<'a> FIRST::Output<'a>: Borrow>, +{ + type Input<'a> = FIRST::Input<'a> where Self: 'a; + type Output<'a> = SECOND::Output<'a> where Self: 'a; + + fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { + // evaluate the first node with the given input + // and then pipe the result from the first computation + // into the second node + let arg = self.first.eval(input); + self.second.eval(arg) + } +} + +impl<'n, FIRST, SECOND> ComposeNode<'n, FIRST, SECOND> +where + FIRST: Node, +{ + pub fn new(first: &'n FIRST, second: &'n SECOND) -> Self { + ComposeNode::<'n, FIRST, SECOND> { first, second } + } +} + +pub trait After: Sized { + fn after<'a, First: Node>(&'a self, first: &'a First) -> ComposeNode<'a, First, Self> { + ComposeNode::new(first, self) + } +} +impl After for Second {} + +pub struct ProxyNode(T); +impl Node for ProxyNode { + type Output<'a> = &'a T where Self: 'a; + type Input<'a> = &'a () where Self: 'a; + + fn eval<'a, I: Borrow>>(&'a self, _input: I) -> Self::Output<'a> { + &self.0 + } +} +impl DynamicInput for ProxyNode { + fn set_kwarg_by_name(&mut self, name: &str, value: &dyn Any) { + self.0.set_kwarg_by_name(name, value) + } + + fn set_arg_by_index(&mut self, index: usize, value: &dyn Any) { + self.0.set_arg_by_index(index, value) + } +} diff --git a/node-graph/gstd/src/value.rs b/node-graph/gstd/src/value.rs new file mode 100644 index 000000000..9dde76d62 --- /dev/null +++ b/node-graph/gstd/src/value.rs @@ -0,0 +1,38 @@ +use std::borrow::Borrow; + +use graphene_core::Node; + +pub struct IntNode; +impl Node for IntNode { + type Output<'a> = u32; + type Input<'a> = (); + fn eval<'a, I: Borrow>>(&self, _input: I) -> u32 { + N + } +} + +#[derive(Default)] +pub struct ValueNode(T); +impl Node for ValueNode { + type Output<'o> = &'o T where T: 'o; + type Input<'i> = () where T: 'i; + fn eval<'a, I: Borrow>>(&'a self, _input: I) -> &T { + &self.0 + } +} + +#[rustfmt::skip] +pub trait OutputNode<'a, T>: Node = T> where Self: 'a {} +impl DefaultNode for T {} + +impl ValueNode { + pub fn new(value: T) -> ValueNode { + ValueNode(value) + } +} + +pub trait DefaultNode: Default { + fn default_node() -> ValueNode { + ValueNode::new(Self::default()) + } +} diff --git a/node-graph/proc-macro/Cargo.lock b/node-graph/proc-macro/Cargo.lock index f699244be..ec922eedb 100644 --- a/node-graph/proc-macro/Cargo.lock +++ b/node-graph/proc-macro/Cargo.lock @@ -7,33 +7,45 @@ name = "graph-proc-macros" version = "0.1.0" dependencies = [ "proc-macro2", + "proc_macro_roids", "quote", "syn", ] [[package]] name = "proc-macro2" -version = "1.0.27" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" dependencies = [ "unicode-xid", ] [[package]] -name = "quote" -version = "1.0.9" +name = "proc_macro_roids" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "06675fa2c577f52bcf77fbb511123927547d154faa08097cc012c66ec3c9611a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "quote" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" dependencies = [ "proc-macro2", ] [[package]] name = "syn" -version = "1.0.73" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" +checksum = "704df27628939572cd88d33f171cd6f896f4eaca85252c6e0a72d8d8287ee86f" dependencies = [ "proc-macro2", "quote", diff --git a/node-graph/proc-macro/Cargo.toml b/node-graph/proc-macro/Cargo.toml index f5f0bf0f8..bf70dff81 100644 --- a/node-graph/proc-macro/Cargo.toml +++ b/node-graph/proc-macro/Cargo.toml @@ -10,6 +10,8 @@ path = "src/lib.rs" proc-macro = true [dependencies] -proc-macro2 = "1.0.26" -syn = { version = "1.0.68", features = ["full"] } -quote = "1.0.9" +proc-macro2 = "1.0" +proc_macro_roids = "0.7" +syn = { version = "1.0", features = ["full"] } +quote = "1.0" +graphene-core = {path = "../gcore"} diff --git a/node-graph/proc-macro/src/lib.rs b/node-graph/proc-macro/src/lib.rs index 0e1efc5e5..ee17890c3 100644 --- a/node-graph/proc-macro/src/lib.rs +++ b/node-graph/proc-macro/src/lib.rs @@ -1,4 +1,6 @@ +use graphene_core; use proc_macro::TokenStream; +use proc_macro_roids::*; use quote::{quote, ToTokens}; use syn::punctuated::Punctuated; use syn::{parse_macro_input, FnArg, ItemFn, Pat, Type}; @@ -55,10 +57,8 @@ fn generate_to_string(parsed: ItemFn, string: String) -> TokenStream { .map(|t| t.to_token_stream()) .collect::>(); - let node_fn_name = syn::Ident::new( - &(fn_name.to_string() + "_node"), - proc_macro2::Span::call_site(), - ); // function name/identifier + let node_fn_name = fn_name.append("_node"); + let struct_name = fn_name.append("_node"); let return_type_string = fn_return_type .to_token_stream() .to_string() @@ -72,6 +72,13 @@ fn generate_to_string(parsed: ItemFn, string: String) -> TokenStream { let x = quote! { //#whole_function + mod #fn_name { + struct #struct_name { + + } + impl + + } fn #node_fn_name #generics() -> Node<'static> { Node { func: Box::new(move |x| { let args = x.downcast::<(#(#types,)*)>().expect(#error); diff --git a/node-graph/src/iter.rs b/node-graph/src/iter.rs deleted file mode 100644 index ba424fc38..000000000 --- a/node-graph/src/iter.rs +++ /dev/null @@ -1,38 +0,0 @@ -#[derive(Clone)] -pub struct InsertAfterNth -where - A: Iterator, -{ - n: usize, - iter: A, - value: Option, -} - -impl Iterator for InsertAfterNth -where - A: Iterator, -{ - type Item = A::Item; - - fn next(&mut self) -> Option { - match self.n { - 1.. => { - self.n -= 1; - self.iter.next() - } - 0 if self.value.is_some() => self.value.take(), - _ => self.iter.next(), - } - } -} - -pub fn insert_after_nth(n: usize, iter: A, value: A::Item) -> InsertAfterNth -where - A: Iterator, -{ - InsertAfterNth { - n, - iter, - value: Some(value), - } -} diff --git a/node-graph/src/nodes.rs b/node-graph/src/nodes.rs deleted file mode 100644 index 94bdd0b43..000000000 --- a/node-graph/src/nodes.rs +++ /dev/null @@ -1,269 +0,0 @@ -use std::{ - any::Any, - borrow::Borrow, - cell::RefCell, - collections::{hash_map::DefaultHasher, HashMap}, - hash::{Hash, Hasher}, - iter, - iter::Sum, - marker::PhantomData, -}; - -use crate::{insert_after_nth, After, DynamicInput, Node}; -use once_cell::sync::OnceCell; -use parking_lot::RawRwLock; -use storage_map::{StorageMap, StorageMapGuard}; - -pub struct IntNode; -impl Node for IntNode { - type Output<'a> = u32; - type Input<'a> = (); - fn eval<'a, I: Borrow>>(&self, _input: I) -> u32 { - N - } -} - -#[derive(Default)] -pub struct ValueNode(T); -impl Node for ValueNode { - type Output<'o> = &'o T where T: 'o; - type Input<'i> = () where T: 'i; - fn eval<'a, I: Borrow>>(&'a self, _input: I) -> &T { - &self.0 - } -} - -impl ValueNode { - pub fn new(value: T) -> ValueNode { - ValueNode(value) - } -} - -#[derive(Default)] -pub struct AddNode(PhantomData); -impl Node for AddNode { - type Output<'a> = ::Output; - type Input<'a> = (T, T); - fn eval<'a, I: Borrow>>(&'a self, input: I) -> T::Output { - input.borrow().0 + input.borrow().1 - } -} - -#[derive(Default)] -/// Destructures a Tuple of two values and returns the first one -pub struct FstNode(PhantomData, PhantomData); -impl Node for FstNode { - type Output<'a> = &'a T where Self: 'a; - type Input<'a> = &'a (T, U) where Self: 'a; - fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { - let &(ref a, _) = input.borrow(); - a - } -} - -#[derive(Default)] -/// Destructures a Tuple of two values and returns the first one -pub struct SndNode(PhantomData, PhantomData); -impl Node for SndNode { - type Output<'a> = &'a U where Self: 'a; - type Input<'a> = &'a (T, U) where Self: 'a; - fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { - let &(_, ref b) = input.borrow(); - b - } -} - -pub struct ComposeNode<'n, FIRST, SECOND> { - first: &'n FIRST, - second: &'n SECOND, -} - -impl<'n, FIRST, SECOND> Node for ComposeNode<'n, FIRST, SECOND> -where - FIRST: Node, - SECOND: Node, - for<'a> FIRST::Output<'a>: Borrow>, -{ - type Input<'a> = FIRST::Input<'a> where Self: 'a; - type Output<'a> = SECOND::Output<'a> where Self: 'a; - - fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { - // evaluate the first node with the given input - // and then pipe the result from the first computation - // into the second node - let arg = self.first.eval(input); - self.second.eval(arg) - } -} - -impl<'n, FIRST, SECOND> ComposeNode<'n, FIRST, SECOND> -where - FIRST: Node, -{ - pub fn new(first: &'n FIRST, second: &'n SECOND) -> Self { - ComposeNode::<'n, FIRST, SECOND> { first, second } - } -} - -pub struct FnNode O, In, O>(T, PhantomData, PhantomData); -impl O, In, O> Node for FnNode { - type Output<'a> = O where Self: 'a; - type Input<'a> = In where Self: 'a; - - fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { - self.0(input.borrow()) - } -} - -impl O, In, O> FnNode { - pub fn new(f: T) -> Self { - FnNode(f, PhantomData::default(), PhantomData::default()) - } -} - -pub struct FnNodeWithState O, In, O, State>( - T, - State, - PhantomData, - PhantomData, -); -impl O, In, O, State> Node for FnNodeWithState { - type Output<'a> = O where Self: 'a; - type Input<'a> = In where Self: 'a; - - fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { - self.0(input.borrow(), &self.1) - } -} - -impl O, In, O, State> FnNodeWithState { - pub fn new(f: T, state: State) -> Self { - FnNodeWithState(f, state, PhantomData::default(), PhantomData::default()) - } -} - -/// Caches the output of a given Node and acts as a proxy -pub struct CacheNode<'n, 'c, CachedNode: Node + 'c> { - node: &'n CachedNode, - cache: OnceCell>, -} -impl<'n: 'c, 'c, CashedNode: Node> Node for CacheNode<'n, 'c, CashedNode> { - type Output<'a> = &'a CashedNode::Output<'c> where 'c: 'a; - type Input<'a> = CashedNode::Input<'c> where 'c: 'a; - fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { - self.cache.get_or_init(|| self.node.eval(input)) - } -} - -impl<'n, 'c, CachedNode: Node> CacheNode<'n, 'c, CachedNode> { - pub fn clear(&'n mut self) { - self.cache = OnceCell::new(); - } - pub fn new(node: &'n CachedNode) -> CacheNode<'n, 'c, CachedNode> { - CacheNode { - node, - cache: OnceCell::new(), - } - } -} - -pub struct ProxyNode(T); -impl Node for ProxyNode { - type Output<'a> = &'a T where Self: 'a; - - type Input<'a> = &'a () where Self: 'a; - - fn eval<'a, I: Borrow>>(&'a self, _input: I) -> Self::Output<'a> { - &self.0 - } -} -impl DynamicInput for ProxyNode { - fn set_kwarg_by_name(&mut self, name: &str, value: &dyn Any) { - self.0.set_kwarg_by_name(name, value) - } - - fn set_arg_by_index(&mut self, index: usize, value: &dyn Any) { - self.0.set_arg_by_index(index, value) - } -} - -/// Caches the output of a given Node and acts as a proxy -/// Automatically resets if it receives different input -pub struct SmartCacheNode<'n, 'c, NODE: Node + 'c> { - node: &'n NODE, - map: StorageMap>>, -} -impl<'n: 'c, 'c, NODE: Node + 'c> Node for SmartCacheNode<'n, 'c, NODE> -where - for<'a> NODE::Input<'a>: Hash, -{ - type Input<'a> = NODE::Input<'a> where Self: 'a, 'c : 'a; - type Output<'a> = StorageMapGuard<'a, RawRwLock, CacheNode<'n, 'c, NODE>> where Self: 'a, 'c: 'a; - fn eval<'a, I: Borrow>>(&'a self, input: I) -> Self::Output<'a> { - let mut hasher = DefaultHasher::new(); - input.borrow().hash(&mut hasher); - let hash = hasher.finish(); - - self.map - .get_or_create_with(&hash, || CacheNode::new(self.node)) - } -} - -impl<'n, 'c, NODE: Node> SmartCacheNode<'n, 'c, NODE> { - pub fn clear(&'n mut self) { - self.map = StorageMap::default(); - } - pub fn new(node: &'n NODE) -> SmartCacheNode<'n, 'c, NODE> { - SmartCacheNode { - node, - map: StorageMap::default(), - } - } -} - -/* - -pub struct CurryNthArgNode< - 'n, - CurryNode: Node<'n, OUT>, - ArgNode: Node<'n, ARG>, - ARG: Clone, - OUT, - const NTH: usize, -> { - node: &'n CurryNode, - arg: CacheNode<'n, ArgNode, ARG>, - _phantom_out: std::marker::PhantomData, - _phantom_arg: std::marker::PhantomData, -} -impl< - 'n, - CurryNode: Node<'n, OUT>, - ArgNode: Node<'n, ARG>, - ARG: 'static + Clone, - OUT, - const NTH: usize, - > Node<'n, OUT> for CurryNthArgNode<'n, CurryNode, ArgNode, ARG, OUT, NTH> -{ - fn eval(&'n self, input: impl Iterator + Clone) -> OUT { - let arg = self.arg.eval(iter::empty()); - let arg: &dyn Any = arg as &dyn Any; - self.node.eval(insert_after_nth(NTH, input, arg)) - } -} - -impl<'n, CurryNode: Node<'n, Out>, ArgNode: Node<'n, Arg>, Arg: Clone, Out, const Nth: usize> - CurryNthArgNode<'n, CurryNode, ArgNode, Arg, Out, Nth> -{ - pub fn new(node: &'n CurryNode, arg: &'n ArgNode) -> Self { - CurryNthArgNode::<'n, CurryNode, ArgNode, Arg, Out, Nth> { - node, - arg: CacheNode::new(arg), - _phantom_out: PhantomData::default(), - _phantom_arg: PhantomData::default(), - } - } -} -*/ -/* -*/