mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-03 21:08:18 +00:00
Don't force nodes to store references to other nodes
This commit is contained in:
parent
fa5345d33f
commit
a2703c0fb1
12 changed files with 252 additions and 242 deletions
245
node-graph/Cargo.lock
generated
245
node-graph/Cargo.lock
generated
|
@ -23,6 +23,17 @@ version = "0.7.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.53"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
|
@ -161,20 +172,21 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dashmap"
|
||||
version = "5.2.0"
|
||||
version = "5.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8858831f7781322e539ea39e72449c46b059638250c14344fec8d0aa6e539c"
|
||||
checksum = "3495912c9c1ccf2e18976439f4443f3fee0fd61f424ff99fde6a66b15ecb448f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"num_cpus",
|
||||
"parking_lot 0.12.0",
|
||||
"hashbrown 0.12.1",
|
||||
"lock_api",
|
||||
"parking_lot_core 0.9.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dissimilar"
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31ad93652f40969dead8d4bf897a41e9462095152eb21c56e5830537e41179dd"
|
||||
checksum = "8c97b9233581d84b8e1e689cdd3a47b6f69770084fc246e86a7f78b0d9c1d4a5"
|
||||
|
||||
[[package]]
|
||||
name = "dot"
|
||||
|
@ -267,6 +279,7 @@ dependencies = [
|
|||
name = "graphene-core"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"dyn-any",
|
||||
"spirv-std",
|
||||
]
|
||||
|
@ -281,7 +294,7 @@ dependencies = [
|
|||
"graphene-core",
|
||||
"lock_api",
|
||||
"once_cell",
|
||||
"parking_lot 0.12.0",
|
||||
"parking_lot 0.12.1",
|
||||
"ra_ap_ide",
|
||||
"ra_ap_ide_db",
|
||||
"storage-map",
|
||||
|
@ -295,9 +308,9 @@ checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
|||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.0"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c21d40587b92fa6a6c6e3c1bdbf87d75511db5672f9c93175574b3a00df1758"
|
||||
checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
|
@ -330,9 +343,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.8.1"
|
||||
version = "1.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee"
|
||||
checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown 0.11.2",
|
||||
|
@ -364,9 +377,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.121"
|
||||
version = "0.2.126"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
|
||||
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
|
@ -386,9 +399,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.16"
|
||||
version = "0.4.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8"
|
||||
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
@ -401,9 +414,9 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
|
|||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.4.1"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
||||
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
|
@ -445,9 +458,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.10.0"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
|
||||
checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
|
||||
|
||||
[[package]]
|
||||
name = "oorandom"
|
||||
|
@ -468,12 +481,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.0"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58"
|
||||
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
"parking_lot_core 0.9.2",
|
||||
"parking_lot_core 0.9.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -492,15 +505,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.9.2"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "995f667a6c822200b0433ac218e05582f0e2efa1b922a3fd2fbaadc5f87bab37"
|
||||
checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"smallvec",
|
||||
"windows-sys 0.34.0",
|
||||
"windows-sys 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -540,9 +553,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.8"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c"
|
||||
checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
|
@ -595,9 +608,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_base_db"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2f5a91abfe1bd64ec51cf9c587f652f4317a347cc1242e2485abb95004ce27b"
|
||||
checksum = "ec4122901896d123c835db703bc6fcc14c3c1007dbb02d78c2649ad6e6739cb5"
|
||||
dependencies = [
|
||||
"ra_ap_cfg",
|
||||
"ra_ap_profile",
|
||||
|
@ -612,9 +625,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_cfg"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02c3279764c5318ea19cf3703d222a06bf20239ff9124e59529ab46d5b26c492"
|
||||
checksum = "d5adaaf3169c259be5c519e6f4eaf9a07546bdaa5b8bacf0035de3645f4da2cc"
|
||||
dependencies = [
|
||||
"ra_ap_tt",
|
||||
"rustc-hash",
|
||||
|
@ -622,9 +635,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_hir"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55bd96cece8703de284b01bfff0893a060b164a8580ab60ced1da233da661234"
|
||||
checksum = "02f334df1ac0ceeb8d317e6fc71e6473344ddc8ba75613021a1213ee7b2b3dee"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"either",
|
||||
|
@ -645,12 +658,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_hir_def"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84cd0ecba89b43000dab55a4c78ede7d676244a6c1ac2439349cf73a15ccc98a"
|
||||
checksum = "400a6db17870220d63834cba06883dba10d42beac6f8b3d773e82fe248762adf"
|
||||
dependencies = [
|
||||
"anymap",
|
||||
"arrayvec",
|
||||
"bitflags",
|
||||
"cov-mark",
|
||||
"dashmap",
|
||||
"drop_bomb",
|
||||
|
@ -660,7 +674,7 @@ dependencies = [
|
|||
"itertools",
|
||||
"lock_api",
|
||||
"once_cell",
|
||||
"parking_lot 0.12.0",
|
||||
"parking_lot 0.12.1",
|
||||
"ra_ap_base_db",
|
||||
"ra_ap_cfg",
|
||||
"ra_ap_hir_expand",
|
||||
|
@ -678,13 +692,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_hir_expand"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "063d2fad72fefe5d6d0d5228e37512e10624f20687b6cffd21907cbd56a2b9a7"
|
||||
checksum = "8aefda64ccd9ab7e0db3c37a039e62af675ee2c665faed7da26cd4a78e88a487"
|
||||
dependencies = [
|
||||
"cov-mark",
|
||||
"either",
|
||||
"hashbrown 0.12.0",
|
||||
"hashbrown 0.12.1",
|
||||
"itertools",
|
||||
"ra_ap_base_db",
|
||||
"ra_ap_cfg",
|
||||
|
@ -700,9 +714,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_hir_ty"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db2ea8975f7c5a6831369c52167706ff4642770a262013fbb375a068c88ad157"
|
||||
checksum = "df104472251b6c25c8c1efd8aaaf1c16b76afe2d06e17951478d321a2a1fa9d4"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"chalk-ir",
|
||||
|
@ -729,9 +743,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_ide"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ecabafedcae3017623470cbd6e5e71a07e526cf651914b1dcd64e337501c6d98"
|
||||
checksum = "7df72105729ec1f8464fc2f14c0bbc87c71f25c6d89f19a62791af7c060e091e"
|
||||
dependencies = [
|
||||
"cov-mark",
|
||||
"crossbeam-channel",
|
||||
|
@ -759,9 +773,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_ide_assists"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc569e43edf426f469d2496722101ac3e271840a7ec299c9e2d49fa530aceaeb"
|
||||
checksum = "09f75f4a4eb7358972c2c5e6777a17013df5e4fd39e32526f156e43bcbb05fd0"
|
||||
dependencies = [
|
||||
"cov-mark",
|
||||
"either",
|
||||
|
@ -777,9 +791,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_ide_completion"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9340b4031f514b23a39a389c425bc79f1bd9bcd10f413ac24bfca933afa83df8"
|
||||
checksum = "bbdd9cd37a79ddd73e9a88966693b8b562af6846034237a1f08995b5991abb09"
|
||||
dependencies = [
|
||||
"cov-mark",
|
||||
"either",
|
||||
|
@ -798,9 +812,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_ide_db"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33979ee6d0294911b27f418801a3113b2e4e020f622c429fa326bbf497083081"
|
||||
checksum = "4f0dee6238d74065219229ce0cc75c62ce1ae5630cba3ab5859e0b340705f8d7"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"cov-mark",
|
||||
|
@ -824,9 +838,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_ide_diagnostics"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "54e0e29cffd2c798c02377334fb8533f35d898ac73b7a17d2095ef873bb5cd63"
|
||||
checksum = "73348548ad41cabbd9f45ad51068870c4ee858fc79216f843925d9ab636beb25"
|
||||
dependencies = [
|
||||
"cov-mark",
|
||||
"either",
|
||||
|
@ -843,9 +857,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_ide_ssr"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a560943ffca1b6be3441358fdacb325607686c1659522f140454900cdd0fd5a2"
|
||||
checksum = "81d928f120b669117e640f63deede9c1a4920b0724f98d62ed795e39ac7639f4"
|
||||
dependencies = [
|
||||
"cov-mark",
|
||||
"itertools",
|
||||
|
@ -859,21 +873,21 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_la-arena"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d0df673783137ac10a561b40c3c724503e4aeefa6e4261df268d2f1b9adc172"
|
||||
checksum = "5d3c28b7ef8ec05b8472d93d71dabc2263f8ec19a99a0c0469be7a11ab399d2a"
|
||||
|
||||
[[package]]
|
||||
name = "ra_ap_limit"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b6388e66ec2a29941f451e40a17fd27abb12a2d4aac8b9e16d4eb44c294af73"
|
||||
checksum = "285e82c5aef76b0e5224b78799e3571a0e290cd9cd6ca32191f6e556b87b50bb"
|
||||
|
||||
[[package]]
|
||||
name = "ra_ap_mbe"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "937c357f1c53f2c341a3f2aff603c4976baca8b3e4510ffd0b7e699a18b39abd"
|
||||
checksum = "8c0c5928aa2bac8094b16111800e8a51ddb12310feab28d81f41d3463e9e0c71"
|
||||
dependencies = [
|
||||
"cov-mark",
|
||||
"ra_ap_parser",
|
||||
|
@ -887,9 +901,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_parser"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2bef6d2dd2f9b201730c267d351cc886023a96432977f34167d2af22ce0f548"
|
||||
checksum = "626b67c1acb6795674bd4d83f0700245fb67ad7bb21d0de815578b227fb33767"
|
||||
dependencies = [
|
||||
"drop_bomb",
|
||||
"ra_ap_limit",
|
||||
|
@ -898,15 +912,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_paths"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2402f2a9e1de2ad354011de217f01529caade82fe1d183a5eaa70c0e65080ed1"
|
||||
checksum = "6bfaa2bb72b9737b77d25d0dc634b5978c2a3ca024f966de2055a2c0d6c52684"
|
||||
|
||||
[[package]]
|
||||
name = "ra_ap_profile"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a61c3aac011216b345f80754a91f776a72d267d4e8a42c721c62a5959eb4feec"
|
||||
checksum = "15128f7955c99c82ba17db6d3c3c921719bcb9a6912054486949149d02c4e79a"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"countme",
|
||||
|
@ -919,9 +933,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_stdx"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f9b01b789b9b41433aa76f10e842edd02640aff4fffc1719dd467b39f3fe10c"
|
||||
checksum = "76bf670033bf7b7a707f4e2957108af2b545475808855b3023a1fac69403371d"
|
||||
dependencies = [
|
||||
"always-assert",
|
||||
"libc",
|
||||
|
@ -931,9 +945,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_syntax"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b88f11a5ee695d7910fbbf87e237ed778b70d0352ce4d23bd0cabe8e3341c797"
|
||||
checksum = "6de766172d46071afc07041d37526d4ee4c6446e51d6f5f76b7d0eca816ad21a"
|
||||
dependencies = [
|
||||
"cov-mark",
|
||||
"indexmap",
|
||||
|
@ -951,9 +965,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_test_utils"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0705341c7ca5cfa2ce3aa6dbddfe43eb778feccff03ee02a0013bc2759c4e30e"
|
||||
checksum = "8bc2d20874f0f1740793f04191f78718b7fb7da97dbb5bfc43e48fd316c9d1c1"
|
||||
dependencies = [
|
||||
"dissimilar",
|
||||
"ra_ap_profile",
|
||||
|
@ -964,9 +978,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_text_edit"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62c5d159fa498994a62dc7393182251a235815ad6f83cb2efab1563d15446634"
|
||||
checksum = "5037f6423837aff4117ac62a3bf8fae0fd876e804e3101e201030fb80dae7846"
|
||||
dependencies = [
|
||||
"itertools",
|
||||
"text-size",
|
||||
|
@ -974,9 +988,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_tt"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ac5f623794d2fd42ad3409825bb2126509035f9412324558ce59a5df35e1f3e"
|
||||
checksum = "ff88be31212a08a077437a9688992d3e9ccd41a4e897178ccef4a2abd2cbc2d5"
|
||||
dependencies = [
|
||||
"ra_ap_stdx",
|
||||
"smol_str",
|
||||
|
@ -984,9 +998,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ra_ap_vfs"
|
||||
version = "0.0.102"
|
||||
version = "0.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3ec70fe2d160f2d36131c3469c63d274f30773135772541ab174a6785ca16d4"
|
||||
checksum = "63ee8bde27f1a2df6fd8df1d08a413ee1a3c67cafa7d6a7f5bddacc1f7b0ae85"
|
||||
dependencies = [
|
||||
"fst",
|
||||
"indexmap",
|
||||
|
@ -996,9 +1010,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.5.1"
|
||||
version = "1.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90"
|
||||
checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"crossbeam-deque",
|
||||
|
@ -1008,14 +1022,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.9.1"
|
||||
version = "1.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e"
|
||||
checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
"lazy_static",
|
||||
"num_cpus",
|
||||
]
|
||||
|
||||
|
@ -1030,12 +1043,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rowan"
|
||||
version = "0.15.4"
|
||||
version = "0.15.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4c1112d7b23c800be3a0dae244886b71d96b1461b57b31b56e4c679acbe614f"
|
||||
checksum = "ce1f383129e417a6265b16ed78e6e9307748f0863b2ba75f78ff14717db5b017"
|
||||
dependencies = [
|
||||
"countme",
|
||||
"hashbrown 0.12.0",
|
||||
"hashbrown 0.12.1",
|
||||
"memoffset",
|
||||
"rustc-hash",
|
||||
"text-size",
|
||||
|
@ -1099,9 +1112,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.136"
|
||||
version = "1.0.137"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
|
||||
checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
|
@ -1111,9 +1124,9 @@ checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
|
|||
|
||||
[[package]]
|
||||
name = "smol_str"
|
||||
version = "0.1.21"
|
||||
version = "0.1.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61d15c83e300cce35b7c8cd39ff567c1ef42dde6d4a1a38dbdbf9a59902261bd"
|
||||
checksum = "7475118a28b7e3a2e157ce0131ba8c5526ea96e90ee601d9f6bb2e286a35ab44"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
@ -1186,9 +1199,9 @@ checksum = "288cb548dbe72b652243ea797201f3d481a0609a967980fcc5b2315ea811560a"
|
|||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.5.1"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
|
||||
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
|
@ -1201,9 +1214,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
|||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
version = "0.1.32"
|
||||
version = "0.1.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f"
|
||||
checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"pin-project-lite",
|
||||
|
@ -1213,9 +1226,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.20"
|
||||
version = "0.1.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b"
|
||||
checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -1224,9 +1237,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.24"
|
||||
version = "0.1.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90442985ee2f57c9e1b548ee72ae842f4a9a20e3f417cc38dbc5dc684d9bb4ee"
|
||||
checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
@ -1248,9 +1261,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.7"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
|
||||
checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
|
@ -1328,15 +1341,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.34.0"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5acdd78cb4ba54c0045ac14f62d8f94a03d10047904ae2a40afa1e99d8f70825"
|
||||
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
|
||||
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",
|
||||
"windows_aarch64_msvc 0.36.1",
|
||||
"windows_i686_gnu 0.36.1",
|
||||
"windows_i686_msvc 0.36.1",
|
||||
"windows_x86_64_gnu 0.36.1",
|
||||
"windows_x86_64_msvc 0.36.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1347,9 +1360,9 @@ checksum = "52695a41e536859d5308cc613b4a022261a274390b25bd29dfff4bf08505f3c2"
|
|||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.34.0"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d"
|
||||
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
|
@ -1359,9 +1372,9 @@ checksum = "f54725ac23affef038fecb177de6c9bf065787c2f432f79e3c373da92f3e1d8a"
|
|||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.34.0"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed"
|
||||
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
|
@ -1371,9 +1384,9 @@ checksum = "51d5158a43cc43623c0729d1ad6647e62fa384a3d135fd15108d37c683461f64"
|
|||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.34.0"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956"
|
||||
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
|
@ -1383,9 +1396,9 @@ checksum = "bc31f409f565611535130cfe7ee8e6655d3fa99c1c61013981e491921b5ce954"
|
|||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.34.0"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4"
|
||||
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
|
@ -1395,6 +1408,6 @@ checksum = "3f2b8c7cbd3bfdddd9ab98769f9746a7fad1bca236554cd032b78d768bc0e89f"
|
|||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.34.0"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9"
|
||||
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[workspace]
|
||||
|
||||
members = [
|
||||
"proc-macro",
|
||||
#"proc-macro",
|
||||
"gcore",
|
||||
"gstd",
|
||||
"borrow_stack"
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit dd588ea0f72c0e12d86506047652b38f644bd5ca
|
||||
Subproject commit c4933672deec310f1eeedf879ed36dcc1c1093bc
|
|
@ -9,11 +9,13 @@ authors = ["Dennis Kobert <dennis@kobert.dev>"]
|
|||
|
||||
[features]
|
||||
std = ["dyn-any"]
|
||||
default = ["gpu"]
|
||||
default = ["gpu", "async"]
|
||||
gpu = ["spirv-std"]
|
||||
async = ["async-trait"]
|
||||
nightly = []
|
||||
|
||||
[dependencies]
|
||||
dyn-any = {path = "../dyn-any", features = ["derive"], optional = true}
|
||||
|
||||
spirv-std = { git = "https://github.com/EmbarkStudios/rust-gpu", features = ["glam"] , optional = true}
|
||||
async-trait = {version = "0.1", optional = true}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use core::marker::PhantomData;
|
||||
|
||||
use crate::Node;
|
||||
pub struct FnNode<'n, T: Fn(<N as Node>::Output) -> O, N: Node<'n>, O: 'n>(
|
||||
pub struct FnNode<'n, T: Fn(<N as Node<'n>>::Output) -> O, N: Node<'n>, O>(
|
||||
T,
|
||||
&'n N,
|
||||
PhantomData<O>,
|
||||
N,
|
||||
PhantomData<&'n O>,
|
||||
);
|
||||
impl<'n, T: Fn(<N as Node>::Output) -> O, N: Node<'n>, O> Node<'n> for FnNode<'n, T, N, O> {
|
||||
impl<'n, T: Fn(<N as Node<'n>>::Output) -> O, N: Node<'n>, O> Node<'n> for FnNode<'n, T, N, O> {
|
||||
type Output = O;
|
||||
|
||||
fn eval(&'n self) -> Self::Output {
|
||||
|
@ -14,19 +14,20 @@ impl<'n, T: Fn(<N as Node>::Output) -> O, N: Node<'n>, O> Node<'n> for FnNode<'n
|
|||
}
|
||||
}
|
||||
|
||||
impl<'n, T: Fn(<N as Node>::Output) -> O, N: Node<'n>, O> FnNode<'n, T, N, O> {
|
||||
pub fn new(f: T, input: &'n N) -> Self {
|
||||
impl<'n, T: Fn(<N as Node<'n>>::Output) -> O, N: Node<'n>, O> FnNode<'n, T, N, O> {
|
||||
pub fn new(f: T, input: N) -> Self {
|
||||
FnNode(f, input, PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct FnNodeWithState<'n, T: Fn(N::Output, &State) -> O, N: Node<'n>, O, State>(
|
||||
T,
|
||||
&'n N,
|
||||
State,
|
||||
PhantomData<O>,
|
||||
);
|
||||
impl<'n, T: Fn(N::Output, &State) -> O, N: Node<'n>, O: 'n, State> Node<'n>
|
||||
pub struct FnNodeWithState<
|
||||
'n,
|
||||
T: Fn(<N as Node<'n>>::Output, &State) -> O,
|
||||
N: Node<'n>,
|
||||
O,
|
||||
State: 'n,
|
||||
>(T, N, State, PhantomData<&'n O>);
|
||||
impl<'n, T: Fn(<N as Node<'n>>::Output, &State) -> O, N: Node<'n>, O: 'n, State> Node<'n>
|
||||
for FnNodeWithState<'n, T, N, O, State>
|
||||
{
|
||||
type Output = O;
|
||||
|
@ -37,7 +38,7 @@ impl<'n, T: Fn(N::Output, &State) -> O, N: Node<'n>, O: 'n, State> Node<'n>
|
|||
}
|
||||
|
||||
impl<'n, T: Fn(N::Output, &State) -> O, N: Node<'n>, O, State> FnNodeWithState<'n, T, N, O, State> {
|
||||
pub fn new(f: T, input: &'n N, state: State) -> Self {
|
||||
pub fn new(f: T, input: N, state: State) -> Self {
|
||||
FnNodeWithState(f, input, state, PhantomData)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,50 @@
|
|||
#![no_std]
|
||||
#![cfg_attr(target_arch = "spirv", feature(register_attr), register_attr(spirv))]
|
||||
|
||||
#[cfg(feature = "async")]
|
||||
extern crate alloc;
|
||||
#[cfg(feature = "async")]
|
||||
use alloc::boxed::Box;
|
||||
#[cfg(feature = "async")]
|
||||
use async_trait::async_trait;
|
||||
|
||||
pub mod generic;
|
||||
pub mod ops;
|
||||
//pub mod structural;
|
||||
pub mod value;
|
||||
|
||||
#[rustfmt::skip]
|
||||
pub trait Node<'n> {
|
||||
type Output: 'n; // TODO: replace with generic associated type
|
||||
|
||||
fn eval(&'n self) -> Self::Output;
|
||||
}
|
||||
|
||||
impl<'n, N: Node<'n>> Node<'n> for &'n N {
|
||||
type Output = N::Output;
|
||||
|
||||
fn eval(&'n self) -> Self::Output {
|
||||
Node::eval(*self)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "async")]
|
||||
#[async_trait]
|
||||
pub trait AsyncNode<'n> {
|
||||
type Output: 'n; // TODO: replace with generic associated type
|
||||
|
||||
async fn eval(&'n self) -> Self::Output;
|
||||
}
|
||||
|
||||
#[cfg(feature = "async")]
|
||||
#[async_trait]
|
||||
impl<'n, N: Node<'n> + Sync> AsyncNode<'n> for N {
|
||||
type Output = N::Output;
|
||||
|
||||
async fn eval(&'n self) -> Self::Output {
|
||||
Node::eval(self)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Cache {
|
||||
fn clear(&mut self);
|
||||
}
|
||||
|
|
|
@ -1,35 +1,36 @@
|
|||
use core::ops::Add;
|
||||
use core::{marker::PhantomData, ops::Add};
|
||||
|
||||
use crate::Node;
|
||||
|
||||
#[repr(C)]
|
||||
struct AddNode<'n, T: Add, I1: Node<'n, Output = T>, I2: Node<'n, Output = T>>(
|
||||
pub &'n I1,
|
||||
pub &'n I2,
|
||||
struct AddNode<'n, L: Add<R>, R, I1: Node<'n, Output = L>, I2: Node<'n, Output = R>>(
|
||||
pub I1,
|
||||
pub I2,
|
||||
PhantomData<&'n (L, R)>,
|
||||
);
|
||||
impl<'n, T: Add + 'n, I1: Node<'n, Output = T>, I2: Node<'n, Output = T>> Node<'n>
|
||||
for AddNode<'n, T, I1, I2>
|
||||
impl<'n, L: Add<R>, R, I1: Node<'n, Output = L>, I2: Node<'n, Output = R>> Node<'n>
|
||||
for AddNode<'n, L, R, I1, I2>
|
||||
{
|
||||
type Output = <T as Add>::Output;
|
||||
fn eval(&self) -> T::Output {
|
||||
type Output = <L as Add<R>>::Output;
|
||||
fn eval(&'n self) -> Self::Output {
|
||||
self.0.eval() + self.1.eval()
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct CloneNode<'n, N: Node<'n, Output = &'n O>, O: Clone + 'n>(pub &'n N);
|
||||
pub struct CloneNode<'n, N: Node<'n, Output = &'n O>, O: Clone + 'n>(pub N, PhantomData<&'n ()>);
|
||||
impl<'n, N: Node<'n, Output = &'n O>, O: Clone> Node<'n> for CloneNode<'n, N, O> {
|
||||
type Output = O;
|
||||
fn eval(&self) -> Self::Output {
|
||||
fn eval(&'n self) -> Self::Output {
|
||||
self.0.eval().clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct FstNode<'n, N: Node<'n>>(pub &'n N);
|
||||
pub struct FstNode<'n, N: Node<'n>>(pub N, PhantomData<&'n ()>);
|
||||
impl<'n, T: 'n, U, N: Node<'n, Output = (T, U)>> Node<'n> for FstNode<'n, N> {
|
||||
type Output = T;
|
||||
fn eval(&self) -> Self::Output {
|
||||
fn eval(&'n self) -> Self::Output {
|
||||
let (a, _) = self.0.eval();
|
||||
a
|
||||
}
|
||||
|
@ -37,10 +38,10 @@ impl<'n, T: 'n, U, N: Node<'n, Output = (T, U)>> Node<'n> for FstNode<'n, N> {
|
|||
|
||||
#[repr(C)]
|
||||
/// Destructures a Tuple of two values and returns the first one
|
||||
pub struct SndNode<'n, N: Node<'n>>(pub &'n N);
|
||||
pub struct SndNode<'n, N: Node<'n>>(pub N, PhantomData<&'n ()>);
|
||||
impl<'n, T, U: 'n, N: Node<'n, Output = (T, U)>> Node<'n> for SndNode<'n, N> {
|
||||
type Output = U;
|
||||
fn eval(&self) -> Self::Output {
|
||||
fn eval(&'n self) -> Self::Output {
|
||||
let (_, b) = self.0.eval();
|
||||
b
|
||||
}
|
||||
|
@ -48,34 +49,26 @@ impl<'n, T, U: 'n, N: Node<'n, Output = (T, U)>> Node<'n> for SndNode<'n, N> {
|
|||
|
||||
#[repr(C)]
|
||||
/// Destructures a Tuple of two values and returns the first one
|
||||
pub struct SndRefNode<'n, N: Node<'n>>(pub &'n N);
|
||||
impl<'n, T: 'n, U: 'n, N: Node<'n, Output = &'n (T, U)>> Node<'n> for SndRefNode<'n, N> {
|
||||
type Output = &'n U;
|
||||
fn eval(&self) -> Self::Output {
|
||||
let (_, ref b) = self.0.eval();
|
||||
b
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
/// Destructures a Tuple of two values and returns the first one
|
||||
pub struct DupNode<'n, N: Node<'n>>(&'n N);
|
||||
pub struct DupNode<'n, N: Node<'n>>(N, PhantomData<&'n ()>);
|
||||
impl<'n, N: Node<'n>> Node<'n> for DupNode<'n, N> {
|
||||
type Output = (N::Output, N::Output);
|
||||
fn eval(&self) -> Self::Output {
|
||||
fn eval(&'n self) -> Self::Output {
|
||||
(self.0.eval(), self.0.eval()) //TODO: use Copy/Clone implementation
|
||||
}
|
||||
}
|
||||
|
||||
pub fn foo() {
|
||||
let value = crate::value::ValueNode::new(2u32);
|
||||
let dup = DupNode(&value);
|
||||
let value2 = crate::value::ValueNode::new(4u32);
|
||||
let dup = DupNode(value, PhantomData);
|
||||
fn swap<'n>(input: (&'n u32, &'n u32)) -> (&'n u32, &'n u32) {
|
||||
(input.1, input.0)
|
||||
}
|
||||
//let fnn = crate::generic::FnNode::new(swap, &dup); TODO fix types
|
||||
let snd = SndNode(&dup);
|
||||
let add = AddNode(&snd, &value);
|
||||
let fnn = crate::generic::FnNode::new(swap, &dup);
|
||||
let _ = fnn.eval();
|
||||
let snd = SndNode(&fnn, PhantomData);
|
||||
let _ = snd.eval();
|
||||
let add = AddNode(&snd, value2, PhantomData);
|
||||
let _ = add.eval();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ use core::marker::PhantomData;
|
|||
|
||||
use crate::Node;
|
||||
|
||||
pub struct ComposeNode<'n, Input, Inter, FIRST, SECOND> {
|
||||
first: &'n FIRST,
|
||||
second: &'n SECOND,
|
||||
pub struct ComposeNode<'n, Inter, First, Second> {
|
||||
first: &'n First,
|
||||
second: &'n Second,
|
||||
_phantom: PhantomData<&'n Input>,
|
||||
_phantom2: PhantomData<Inter>,
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "nightly")]
|
||||
impl<'n, Input, Inter, FIRST, SECOND> ComposeNode<'n, Input, Inter, FIRST, SECOND>
|
||||
where
|
||||
FIRST: Node<'n, Input>,
|
||||
|
@ -41,20 +40,6 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "nightly"))]
|
||||
impl<'n, Input, Inter, FIRST, SECOND> ComposeNode<'n, Input, Inter, FIRST, SECOND>
|
||||
where
|
||||
FIRST: Node<'n, Input>,
|
||||
{
|
||||
pub fn new(first: &'n FIRST, second: &'n SECOND) -> Self {
|
||||
ComposeNode::<'n, Input, Inter, FIRST, SECOND> {
|
||||
first,
|
||||
second,
|
||||
_phantom: PhantomData,
|
||||
_phantom2: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
#[repr(C)]
|
||||
pub struct ComposeNodeOwned<'n, Input, Inter, FIRST, SECOND> {
|
||||
first: FIRST,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
pub mod value;
|
||||
pub use graphene_core::{generic, ops, structural};
|
||||
pub use graphene_core::{generic, ops /*, structural*/};
|
||||
|
||||
#[cfg(feature = "caching")]
|
||||
pub mod caching;
|
||||
|
@ -9,25 +9,10 @@ pub mod memo;
|
|||
pub use graphene_core::*;
|
||||
|
||||
use dyn_any::{downcast_ref, DynAny, StaticType};
|
||||
pub type DynNode<'n, T> = &'n (dyn Node<'n, (), Output = T> + 'n);
|
||||
pub type DynAnyNode<'n> = &'n (dyn Node<'n, (), Output = &'n dyn DynAny<'n>> + 'n);
|
||||
pub type DynNode<'n, T> = &'n (dyn Node<'n, Output = T> + 'n);
|
||||
pub type DynAnyNode<'n> = &'n (dyn Node<'n, Output = &'n dyn DynAny<'n>> + 'n);
|
||||
|
||||
pub trait DynamicInput<'n> {
|
||||
fn set_kwarg_by_name(&mut self, name: &str, value: DynAnyNode<'n>);
|
||||
fn set_arg_by_index(&mut self, index: usize, value: DynAnyNode<'n>);
|
||||
}
|
||||
|
||||
pub trait AnyRef<'n, I: 'n + StaticType>: Node<'n, &'n I> {
|
||||
fn any(&'n self, input: &'n dyn DynAny<'n>) -> Self::Output;
|
||||
}
|
||||
|
||||
impl<'n, N: Node<'n, &'n I>, I: StaticType + 'n> AnyRef<'n, I> for N {
|
||||
fn any(&'n self, input: &'n dyn DynAny<'n>) -> Self::Output {
|
||||
self.eval(downcast_ref::<I>(input).unwrap_or_else(|| {
|
||||
panic!(
|
||||
"Node was evaluated with wrong input. The input has to be of type: {}",
|
||||
std::any::type_name::<I>(),
|
||||
)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,13 +25,13 @@ mod mul {
|
|||
pub a: Option<DynNode<'n, &'n f32>>,
|
||||
pub b: Option<DynNode<'n, &'n f32>>,
|
||||
}
|
||||
impl<'n> Node<'n, ()> for MulNodeAnyProxy<'n> {
|
||||
impl<'n> Node<'n> for MulNodeAnyProxy<'n> {
|
||||
type Output = MulNodeInput<'n>;
|
||||
fn eval(&'n self, _input: ()) -> <Self as graphene_std::Node<'n, ()>>::Output {
|
||||
let a = self.a.unwrap().eval(());
|
||||
fn eval(&'n self) -> <Self as graphene_std::Node<'n>>::Output {
|
||||
let a = self.a.unwrap().eval();
|
||||
let a: &f32 = self
|
||||
.a
|
||||
.map(|v| downcast_ref(v.eval(())).unwrap())
|
||||
.map(|v| downcast_ref(v.eval()).unwrap())
|
||||
.unwrap_or(&1.);
|
||||
/*let b: &f32 = self
|
||||
.b
|
||||
|
@ -41,11 +41,11 @@ mod mul {
|
|||
MulNodeInput { a, b: a }
|
||||
}
|
||||
}
|
||||
impl<'n> Node<'n, ()> for MulNodeTypedProxy<'n> {
|
||||
impl<'n> Node<'n> for MulNodeTypedProxy<'n> {
|
||||
type Output = MulNodeInput<'n>;
|
||||
fn eval(&'n self, _input: ()) -> <Self as graphene_std::Node<'n, ()>>::Output {
|
||||
let a = self.a.unwrap().eval(());
|
||||
let b = self.b.unwrap().eval(());
|
||||
fn eval(&'n self) -> <Self as graphene_std::Node<'n>>::Output {
|
||||
let a = self.a.unwrap().eval();
|
||||
let b = self.b.unwrap().eval();
|
||||
MulNodeInput { a, b }
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ mod mul {
|
|||
}
|
||||
}
|
||||
}
|
||||
type SNode<'n> = dyn Node<'n, (), Output = &'n dyn DynAny<'n>>;
|
||||
type SNode<'n> = dyn Node<'n, Output = &'n dyn DynAny<'n>>;
|
||||
|
||||
struct NodeStore<'n>(borrow_stack::FixedSizeStack<'n, Box<SNode<'n>>>);
|
||||
|
||||
|
@ -91,14 +91,16 @@ impl<'n> NodeStore<'n> {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
use dyn_any::{downcast_ref, DynAny, StaticType};
|
||||
//let mut mul = mul::MulNode::new();
|
||||
let mut stack: borrow_stack::FixedSizeStack<Box<dyn Node<'_, (), Output = &dyn DynAny>>> =
|
||||
let mut stack: borrow_stack::FixedSizeStack<Box<dyn Node<'_, Output = &dyn DynAny>>> =
|
||||
borrow_stack::FixedSizeStack::new(42);
|
||||
unsafe { stack.push(Box::new(AnyValueNode::new(1f32))) };
|
||||
//let node = unsafe { stack.get(0) };
|
||||
//let boxed = Box::new(StorageNode::new(node));
|
||||
//unsafe { stack.push(boxed) };
|
||||
let result = unsafe { &stack.get()[0] }.eval(());
|
||||
let result = unsafe { &stack.get()[0] }.eval();
|
||||
dbg!(downcast_ref::<f32>(result));
|
||||
/*unsafe {
|
||||
stack
|
||||
.push(Box::new(AnyRefNode::new(stack.get(0).as_ref()))
|
||||
|
@ -117,8 +119,8 @@ fn main() {
|
|||
//let foo = value::AnyRefNode::new(&cached);
|
||||
mul2.set_arg_by_index(0, &any_a);*/
|
||||
let int = value::IntNode::<32>;
|
||||
int.exec();
|
||||
println!("{}", int.exec());
|
||||
Node::eval(&int);
|
||||
println!("{}", Node::eval(&int));
|
||||
//let _add: u32 = ops::AddNode::<u32>::default().eval((int.exec(), int.exec()));
|
||||
//let fnode = generic::FnNode::new(|(a, b): &(i32, i32)| a - b);
|
||||
//let sub = fnode.any(&("a", 2));
|
||||
|
|
|
@ -1,30 +1,33 @@
|
|||
use graphene_core::{Cache, Node};
|
||||
use once_cell::sync::OnceCell;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
/// Caches the output of a given Node and acts as a proxy
|
||||
pub struct CacheNode<'n, CachedNode: Node<'n, Input>, Input> {
|
||||
node: &'n CachedNode,
|
||||
pub struct CacheNode<'n, CachedNode: Node<'n>> {
|
||||
node: CachedNode,
|
||||
cache: OnceCell<CachedNode::Output>,
|
||||
_phantom: PhantomData<&'n ()>,
|
||||
}
|
||||
impl<'n, CashedNode: Node<'n, Input>, Input> Node<'n, Input> for CacheNode<'n, CashedNode, Input> {
|
||||
impl<'n, CashedNode: Node<'n>> Node<'n> for CacheNode<'n, CashedNode> {
|
||||
type Output = &'n CashedNode::Output;
|
||||
fn eval(&'n self, input: Input) -> Self::Output {
|
||||
self.cache.get_or_init(|| self.node.eval(input))
|
||||
fn eval(&'n self) -> Self::Output {
|
||||
self.cache.get_or_init(|| self.node.eval())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'n, CachedNode: Node<'n, Input>, Input> CacheNode<'n, CachedNode, Input> {
|
||||
impl<'n, CachedNode: Node<'n>> CacheNode<'n, CachedNode> {
|
||||
pub fn clear(&'n mut self) {
|
||||
self.cache = OnceCell::new();
|
||||
}
|
||||
pub fn new(node: &'n CachedNode) -> CacheNode<'n, CachedNode, Input> {
|
||||
pub fn new(node: CachedNode) -> CacheNode<'n, CachedNode> {
|
||||
CacheNode {
|
||||
node,
|
||||
cache: OnceCell::new(),
|
||||
_phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl<'n, CachedNode: Node<'n, Input>, Input> Cache for CacheNode<'n, CachedNode, Input> {
|
||||
impl<'n, CachedNode: Node<'n>> Cache for CacheNode<'n, CachedNode> {
|
||||
fn clear(&mut self) {
|
||||
self.cache = OnceCell::new();
|
||||
}
|
||||
|
|
|
@ -4,47 +4,41 @@ use graphene_core::Node;
|
|||
|
||||
use dyn_any::{DynAny, StaticType, StaticTypeSized};
|
||||
|
||||
pub struct AnyRefNode<'n, N: Node<'n, I, Output = O>, I, O>(
|
||||
&'n N,
|
||||
PhantomData<&'n I>,
|
||||
PhantomData<&'n O>,
|
||||
);
|
||||
pub struct AnyRefNode<'n, N: Node<'n>>(N, PhantomData<&'n ()>);
|
||||
|
||||
impl<'n, N: Node<'n, I, Output = &'n O>, I, O: DynAny<'n>> Node<'n, I>
|
||||
for AnyRefNode<'n, N, I, &'n O>
|
||||
{
|
||||
impl<'n, N: Node<'n, Output = &'n O>, O: DynAny<'n> + 'n> Node<'n> for AnyRefNode<'n, N> {
|
||||
type Output = &'n (dyn DynAny<'n>);
|
||||
fn eval(&'n self, input: I) -> Self::Output {
|
||||
let value: &O = self.0.eval(input);
|
||||
fn eval(&'n self) -> Self::Output {
|
||||
let value: &O = self.0.eval();
|
||||
value
|
||||
}
|
||||
}
|
||||
impl<'n, N: Node<'n, I, Output = &'n O>, I, O: 'n + ?Sized> AnyRefNode<'n, N, I, &'n O> {
|
||||
pub fn new(n: &'n N) -> AnyRefNode<'n, N, I, &'n O> {
|
||||
AnyRefNode(n, PhantomData, PhantomData)
|
||||
impl<'n, N: Node<'n, Output = &'n O>, O: 'n + ?Sized> AnyRefNode<'n, N> {
|
||||
pub fn new(n: N) -> AnyRefNode<'n, N> {
|
||||
AnyRefNode(n, PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct StorageNode<'n>(&'n dyn Node<'n, (), Output = &'n dyn DynAny<'n>>);
|
||||
pub struct StorageNode<'n>(&'n dyn Node<'n, Output = &'n dyn DynAny<'n>>);
|
||||
|
||||
impl<'n> Node<'n, ()> for StorageNode<'n> {
|
||||
impl<'n> Node<'n> for StorageNode<'n> {
|
||||
type Output = &'n (dyn DynAny<'n>);
|
||||
fn eval(&'n self, input: ()) -> Self::Output {
|
||||
let value = self.0.eval(input);
|
||||
fn eval(&'n self) -> Self::Output {
|
||||
let value = self.0.eval();
|
||||
value
|
||||
}
|
||||
}
|
||||
impl<'n> StorageNode<'n> {
|
||||
pub fn new<N: Node<'n, (), Output = &'n dyn DynAny<'n>>>(n: &'n N) -> StorageNode<'n> {
|
||||
pub fn new<N: Node<'n, Output = &'n dyn DynAny<'n>>>(n: &'n N) -> StorageNode<'n> {
|
||||
StorageNode(n)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct AnyValueNode<'n, T>(T, PhantomData<&'n ()>);
|
||||
impl<'n, T: 'n + DynAny<'n>> Node<'n, ()> for AnyValueNode<'n, T> {
|
||||
impl<'n, T: 'n + DynAny<'n>> Node<'n> for AnyValueNode<'n, T> {
|
||||
type Output = &'n dyn DynAny<'n>;
|
||||
fn eval(&'n self, _input: ()) -> &'n dyn DynAny<'n> {
|
||||
fn eval(&'n self) -> &'n dyn DynAny<'n> {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue