diff --git a/Cargo.lock b/Cargo.lock index 65d6c53..d5a75f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,9 +43,15 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstyle" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "autocfg" @@ -59,11 +65,17 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "bitflags" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" + [[package]] name = "bumpalo" -version = "3.19.1" +version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" [[package]] name = "cast" @@ -73,9 +85,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.52" +version = "1.2.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd4932aefd12402b36c60956a4fe0035421f544799057659ff86f923657aada3" +checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423" dependencies = [ "find-msvc-tools", "shlex", @@ -89,9 +101,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chrono" -version = "0.4.42" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" dependencies = [ "iana-time-zone", "num-traits", @@ -128,18 +140,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.54" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e6ff9dcd79cff5cd969a17a545d79e84ab086e444102a591e288a8aa3ce394" +checksum = "b193af5b67834b676abd72466a96c1024e6a6ad978a1f484bd90b85c94041351" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.54" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" dependencies = [ "anstyle", "clap_lex", @@ -147,9 +159,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.6" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "core-foundation-sys" @@ -159,9 +171,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "criterion" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d883447757bb0ee46f233e9dc22eb84d93a9508c9b868687b274fc431d886bf" +checksum = "950046b2aa2492f9a536f5f4f9a3de7b9e2476e575e05bd6c333371add4d98f3" dependencies = [ "alloca", "anes", @@ -184,9 +196,9 @@ dependencies = [ [[package]] name = "criterion-plot" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed943f81ea2faa8dcecbbfa50164acf95d555afec96a27871663b300e387b2e4" +checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea" dependencies = [ "cast", "itertools", @@ -225,9 +237,9 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "darling" -version = "0.20.11" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" dependencies = [ "darling_core", "darling_macro", @@ -235,11 +247,10 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.11" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" dependencies = [ - "fnv", "ident_case", "proc-macro2", "quote", @@ -249,9 +260,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.11" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ "darling_core", "quote", @@ -260,14 +271,20 @@ dependencies = [ [[package]] name = "deranged" -version = "0.5.5" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ "powerfmt", "serde_core", ] +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + [[package]] name = "either" version = "1.15.0" @@ -282,15 +299,15 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "find-msvc-tools" -version = "0.1.7" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f449e6c6c08c865631d4890cfacf252b3d396c9bcc83adb6623cdb02a8336c41" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] -name = "fnv" -version = "1.0.7" +name = "foldhash" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "foldhash" @@ -300,15 +317,17 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] name = "getrandom" -version = "0.3.4" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" dependencies = [ "cfg-if", "js-sys", "libc", "r-efi", + "rand_core 0.10.0", "wasip2", + "wasip3", "wasm-bindgen", ] @@ -329,6 +348,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + [[package]] name = "hashbrown" version = "0.16.1" @@ -337,13 +365,19 @@ checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ "allocator-api2", "equivalent", - "foldhash", + "foldhash 0.2.0", "rayon", "rustc-std-workspace-alloc", "serde", "serde_core", ] +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hex" version = "0.4.3" @@ -352,9 +386,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "iana-time-zone" -version = "0.1.64" +version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -374,6 +408,12 @@ dependencies = [ "cc", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "ident_case" version = "1.0.1" @@ -414,15 +454,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "js-sys" -version = "0.3.83" +version = "0.3.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" +checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" dependencies = [ "once_cell", "wasm-bindgen", @@ -434,17 +474,23 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libc" -version = "0.2.180" +version = "0.2.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" +checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" [[package]] name = "libm" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "log" @@ -473,9 +519,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.6" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "ndarray" @@ -515,9 +561,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" [[package]] name = "num-integer" @@ -540,9 +586,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "oorandom" @@ -568,9 +614,9 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pin-project-lite" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "plotters" @@ -602,15 +648,15 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" [[package]] name = "portable-atomic-util" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +checksum = "091397be61a01d4be58e7841595bd4bfedb15f1cd54977d79b8271e94ed799a3" dependencies = [ "portable-atomic", ] @@ -622,37 +668,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] -name = "ppv-lite86" -version = "0.2.21" +name = "prettyplease" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ - "zerocopy", + "proc-macro2", + "syn", ] [[package]] name = "proc-macro2" -version = "1.0.105" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.43" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] [[package]] name = "r-efi" -version = "5.3.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] name = "rand" @@ -665,25 +712,15 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +checksum = "bc266eb313df6c5c09c1c7b1fbe2510961e5bcd3add930c1e31f7ed9da0feff8" dependencies = [ - "rand_chacha", - "rand_core 0.9.3", + "getrandom", + "rand_core 0.10.0", "serde", ] -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core 0.9.3", -] - [[package]] name = "rand_core" version = "0.6.4" @@ -692,22 +729,18 @@ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] name = "rand_core" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" -dependencies = [ - "getrandom", - "serde", -] +checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" [[package]] name = "rand_distr" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8615d50dcf34fa31f7ab52692afec947c4dd0ab803cc87cb3b0b4570ff7463" +checksum = "4d431c2703ccf129de4d45253c03f49ebb22b97d6ad79ee3ecfc7e3f4862c1d8" dependencies = [ "num-traits", - "rand 0.9.2", + "rand 0.10.0", "serde", "serde_with", ] @@ -738,11 +771,31 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "regex" -version = "1.12.2" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -752,9 +805,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -763,13 +816,13 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "rspace" -version = "0.0.9" +version = "0.1.0" dependencies = [ "criterion", "rspace-core", @@ -780,13 +833,13 @@ dependencies = [ [[package]] name = "rspace-core" -version = "0.0.9" +version = "0.1.0" dependencies = [ "getrandom", "hashbrown 0.16.1", "num-complex", "num-traits", - "rand 0.9.2", + "rand 0.10.0", "rand_distr", "rspace-traits", "serde", @@ -798,7 +851,7 @@ dependencies = [ [[package]] name = "rspace-traits" -version = "0.0.9" +version = "0.1.0" dependencies = [ "hashbrown 0.16.1", "ndarray", @@ -829,6 +882,36 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + [[package]] name = "serde" version = "1.0.228" @@ -874,17 +957,18 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.11.0" +version = "3.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" +checksum = "dd5414fad8e6907dbdd5bc441a50ae8d6e26151a03b1de04d89a5576de61d01f" dependencies = [ "base64", "chrono", "hex", "indexmap 1.9.3", "indexmap 2.13.0", - "serde", - "serde_derive", + "schemars 0.9.0", + "schemars 1.2.1", + "serde_core", "serde_json", "serde_with_macros", "time", @@ -892,9 +976,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.11.0" +version = "3.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" +checksum = "d3db8978e608f1fe7357e211969fd9abdcae80bac1ba7a3369bb7eb6b404eb65" dependencies = [ "darling", "proc-macro2", @@ -931,9 +1015,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.114" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -942,18 +1026,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", @@ -971,30 +1055,30 @@ dependencies = [ [[package]] name = "time" -version = "0.3.44" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", "itoa", "num-conv", "powerfmt", - "serde", + "serde_core", "time-core", "time-macros", ] [[package]] name = "time-core" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" -version = "0.2.24" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" dependencies = [ "num-conv", "time-core", @@ -1056,9 +1140,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.22" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" dependencies = [ "matchers", "nu-ansi-term", @@ -1074,9 +1158,15 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.22" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-xid" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "valuable" @@ -1096,18 +1186,27 @@ dependencies = [ [[package]] name = "wasip2" -version = "1.0.1+wasi-0.2.4" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" dependencies = [ "wit-bindgen", ] [[package]] name = "wasm-bindgen" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" +checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" dependencies = [ "cfg-if", "once_cell", @@ -1118,9 +1217,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" +checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1128,9 +1227,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" +checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" dependencies = [ "bumpalo", "proc-macro2", @@ -1141,18 +1240,52 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.106" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" +checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap 2.13.0", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap 2.13.0", + "semver", +] + [[package]] name = "web-sys" -version = "0.3.83" +version = "0.3.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac" +checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" dependencies = [ "js-sys", "wasm-bindgen", @@ -1259,24 +1392,106 @@ dependencies = [ [[package]] name = "wit-bindgen" -version = "0.46.0" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap 2.13.0", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap 2.13.0", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.13.0", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] [[package]] name = "zerocopy" -version = "0.8.33" +version = "0.8.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.33" +version = "0.8.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +checksum = "0e8bc7269b54418e7aeeef514aa68f8690b8c0489a06b0136e5f57c4c5ccab89" dependencies = [ "proc-macro2", "quote", @@ -1285,6 +1500,6 @@ dependencies = [ [[package]] name = "zmij" -version = "1.0.13" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac93432f5b761b22864c774aac244fa5c0fd877678a4c37ebf6cf42208f9c9ec" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml index 45f2bb6..6d7a1da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,79 +1,81 @@ -[workspace] -default-members = ["rspace"] -members = [ - "rspace", - "core", - "traits", -] -resolver = "3" - -[workspace.package] -authors = [ - "FL03 (https://github.com/FL03)", -] -categories = [] -description = "rspace focuses on establishing a robust foundation for exploring and utilitizing containers, spaces, fields, and other abstractions in Rust." -edition = "2024" -homepage = "https://github.com/FL03/rspace/wiki" -keywords = ["containers", "hkt", "space", "mathematics", "science"] -license = "Apache-2.0" -readme = "README.md" -repository = "https://github.com/FL03/rspace.git" -rust-version = "1.85.0" -version = "0.0.9" - -[workspace.dependencies] -rspace = { default-features = false, path = "rspace", version = "0.0.9" } -rspace-core = { default-features = false, path = "core", version = "0.0.9" } -rspace-traits = { default-features = false, path = "traits", version = "0.0.9" } -# development & benchmarking -criterion = { version = "0.8" } -# data structures -hashbrown = { default-features = false, version = "0.16" } -ndarray = { default-features = false, version = "0.17" } -# error handling -anyhow = { default-features = false, version = "1" } -thiserror = { default-features = false, version = "2" } -# logging -tracing = { default-features = false, features = ["attributes"], version = "0.1" } -tracing-subscriber = { version = "0.3" } -# math -num-complex = { default-features = false, version = "0.4" } -num-traits = { default-features = false, version = "0.2" } -# random -getrandom = { default-features = false, version = "0.3" } -rand = { default-features = false, version = "0.9" } -rand_distr = { default-features = false, version = "0.5" } -# serialization -serde = { default-features = false, features = ["derive"], version = "1" } -serde_derive = { default-features = false, version = "1" } -serde_json = { default-features = false, version = "1" } -# macros & utilities -paste = { version = "1" } -# WebAssembly -wasm-bindgen = { default-features = false, version = "0.2" } - -# ********* Profiles ********* -[profile.dev] -codegen-units = 256 -debug = true -debug-assertions = true -incremental = true -lto = "thin" -opt-level = 2 -overflow-checks = true -panic = "abort" -rpath = false -strip = false - -[profile.release] -codegen-units = 16 -debug = false -debug-assertions = false -incremental = false -lto = "fat" -opt-level = "z" -overflow-checks = false -panic = "abort" -rpath = false -strip = "debuginfo" +[workspace] +default-members = ["rspace"] +members = [ + "rspace", + "core", + "traits", +] +resolver = "3" + +[workspace.package] +authors = [ + "FL03 (https://github.com/FL03)", +] +categories = [] +description = "rspace focuses on establishing a robust foundation for exploring and utilitizing containers, spaces, fields, and other abstractions in Rust." +edition = "2024" +homepage = "https://github.com/FL03/rspace/wiki" +keywords = ["containers", "hkt", "space", "mathematics", "science"] +license = "Apache-2.0" +readme = "README.md" +repository = "https://github.com/FL03/rspace.git" +rust-version = "1.93.0" +version = "0.1.0" + +[workspace.dependencies] +rspace = { default-features = false, path = "rspace", version = "0.1.0" } +rspace-core = { default-features = false, path = "core", version = "0.1.0" } +rspace-traits = { default-features = false, path = "traits", version = "0.1.0" } +# development & benchmarking +criterion = { version = "0.8" } +# data structures +hashbrown = { default-features = false, version = "0.16" } +ndarray = { default-features = false, version = "0.17" } +# error handling +anyhow = { default-features = false, version = "1" } +thiserror = { default-features = false, version = "2" } +# logging +tracing = { default-features = false, features = ["attributes"], version = "0.1" } +tracing-subscriber = { version = "0.3" } +# math +num-complex = { default-features = false, version = "0.4" } +num-traits = { default-features = false, version = "0.2" } +# random +getrandom = { default-features = false, version = "0.4" } +rand = { default-features = false, version = "0.10" } +rand_distr = { default-features = false, version = "0.6" } +# serialization +serde = { default-features = false, features = ["derive"], version = "1" } +serde_derive = { default-features = false, version = "1" } +serde_json = { default-features = false, version = "1" } +# macros & utilities +paste = { version = "1" } +smart-default = { default-features = false, version = "0.7" } +strum = { default-features = false, features = ["derive"], version = "0.28" } +# WebAssembly +wasm-bindgen = { default-features = false, version = "0.2" } + +# ********* Profiles ********* +[profile.dev] +codegen-units = 256 +debug = true +debug-assertions = true +incremental = true +lto = "thin" +opt-level = 2 +overflow-checks = true +panic = "abort" +rpath = false +strip = false + +[profile.release] +codegen-units = 16 +debug = false +debug-assertions = false +incremental = false +lto = "fat" +opt-level = "z" +overflow-checks = false +panic = "abort" +rpath = false +strip = "debuginfo" diff --git a/README.md b/README.md index 24132fa..1b848c9 100644 --- a/README.md +++ b/README.md @@ -6,19 +6,22 @@ *** -_**The library is currently in the early stages of development and is not yet ready for production use.**_ - rspace is a library dedicated to providing robust abstractions for creating and working with containers (or spaces) within Rust. It aims to offer a flexible solution for managing collections of items, with a focus on safety, efficiency, and ease of use. ## Features - [x] `RawSpace` - The core abstraction for defining spaces. -- [x] `Container` - A higher-kinded trait for defining containers. -- [x] `Store` - A trait for defining key-value stores. +- [x] `Container` - A higher-kinded trait establishing a common interface for all container types. ## Getting Started -Add this to your `Cargo.toml`: +To get started using `rspace`, you can run the following command to add it to your project: + +```bash +cargo add rspace +``` + +or, you can manually add it to your `Cargo.toml`: ```toml [dependencies.rspace] @@ -26,9 +29,7 @@ features = [] version = "0.0.1" ``` -### Examples - -#### _Basic Usage_ +### Basic Usage ```rust extern crate rspace; diff --git a/SECURITY.md b/SECURITY.md index 576daf6..e8c9ae2 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -8,9 +8,9 @@ Checkout the current and supported packages below | Version | Supported | |:-----------------|:--------------------| -| 0.0.7 (latest) | :white_check_mark: | -| >0.0.1,<=0.0.6 | :white_check_mark: | -| 0.0.0 | :x: | +| 0.1.0 (latest) | :white_check_mark: | +| >0.0.6,<=0.0.9 | :white_check_mark: | +| <0.0.5 | :x: | ## Reporting a Vulnerability diff --git a/clippy.toml b/clippy.toml index 4972822..b441194 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1 +1 @@ -msrv = "1.85.0" +msrv = "1.93.0" diff --git a/core/Cargo.toml b/core/Cargo.toml index c6cdbf8..1525162 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,162 +1,163 @@ -[package] -build = "build.rs" -description = "Core modules for the rspace framework" -name = "rspace-core" - -authors.workspace = true -categories.workspace = true -edition.workspace = true -homepage.workspace = true -keywords.workspace = true -license.workspace = true -readme.workspace = true -repository.workspace = true -rust-version.workspace = true -version.workspace = true - -[package.metadata.docs.rs] -all-features = false -features = ["default"] -rustc-args = ["--cfg", "docsrs"] -version = "v{{version}}" - -[package.metadata.release] -no-dev-version = true -tag-name = "{{version}}" - -[lib] -bench = false -crate-type = ["lib"] -doctest = true -test = true - -[dependencies] -rspace-traits = { workspace = true } -# data structures -hashbrown = { optional = true, workspace = true } -# mathematics -num-complex = { optional = true, workspace = true } -num-traits = { workspace = true } -# error handling -thiserror = { workspace = true } -# random -getrandom = { optional = true, workspace = true } -rand = { optional = true, workspace = true } -rand_distr = { optional = true, workspace = true } -# serialization -serde = { optional = true, workspace = true } -serde_derive = { optional = true, workspace = true } -serde_json = { optional = true, workspace = true } -# WebAssembly -wasm-bindgen = { optional = true, workspace = true } - -[features] -default = ["std"] - -full = [ - "default", - "complex", - "ndarray", - "hashbrown", - "json", - "rand", - "serde", -] - -# ********* [FF] Features ********* -json = [ - "alloc", - "serde", - "serde_json", -] - -macros = [] - -nightly = [ - "hashbrown?/nightly", - "rand?/nightly", - "rspace-traits/nightly", -] - -# ********* [FF] Environments ********* -std = [ - "alloc", - "getrandom?/std", - "rspace-traits/std", - "hashbrown?/default", - "num-complex?/std", - "num-traits/std", - "rand?/std", - "rand_distr?/std", - "serde?/std", - "serde_json?/std", - "thiserror/std", -] - -wasi = [ - "rspace-traits/wasi", -] - -wasm = [ - "wasm_bindgen", - "rspace-traits/wasm", - "getrandom?/wasm_js", -] - -# ********* [FF] Dependencies ********* -alloc = [ - "rspace-traits/alloc", - "hashbrown?/alloc", - "rand?/alloc", - "rand_distr?/alloc", - "serde?/alloc", - "serde_json?/alloc", -] - -complex = ["dep:num-complex"] - -ndarray = [ - "rspace-traits/ndarray", -] - -hashbrown = [ - "dep:hashbrown", - "rspace-traits/hashbrown", -] - -rand = [ - "rng", - "dep:rand", - "dep:rand_distr", - "rspace-traits/rand", - "num-complex?/rand", -] - -rayon = [ - "rspace-traits/rayon", - "hashbrown?/rayon", -] - -rng = [ - "dep:getrandom", - "rand?/os_rng", - "rand?/small_rng", -] - -serde = [ - "dep:serde", - "dep:serde_derive", - "serde?/derive", - "hashbrown?/serde", - "num-complex?/serde", - "rand?/serde", - "rand_distr?/serde", - "rspace-traits/serde", -] - -serde_json = ["dep:serde_json"] - -wasm_bindgen = [ - "dep:wasm-bindgen", - "rspace-traits/wasm_bindgen", -] +[package] +build = "build.rs" +description = "Core modules for the rspace framework" +name = "rspace-core" + +authors.workspace = true +categories.workspace = true +edition.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +repository.workspace = true +rust-version.workspace = true +version.workspace = true + +[package.metadata.docs.rs] +all-features = false +features = ["default"] +rustc-args = ["--cfg", "docsrs"] +version = "v{{version}}" + +[package.metadata.release] +no-dev-version = true +tag-name = "{{version}}" + +[lib] +bench = false +crate-type = ["lib"] +doctest = true +test = true + +[dependencies] +rspace-traits = { workspace = true } +# data structures +hashbrown = { optional = true, workspace = true } +# mathematics +num-complex = { optional = true, workspace = true } +num-traits = { workspace = true } +# error handling +thiserror = { workspace = true } +# random +getrandom = { optional = true, workspace = true } +rand = { optional = true, workspace = true } +rand_distr = { optional = true, workspace = true } +# serialization +serde = { optional = true, workspace = true } +serde_derive = { optional = true, workspace = true } +serde_json = { optional = true, workspace = true } +# WebAssembly +wasm-bindgen = { optional = true, workspace = true } + +[features] +default = ["std"] + +full = [ + "default", + "complex", + "ndarray", + "hashbrown", + "json", + "rand", + "serde", +] + +# ********* [FF] Features ********* +json = [ + "alloc", + "serde", + "serde_json", +] + +macros = [] + +nightly = [ + "hashbrown?/nightly", + "rspace-traits/nightly", +] + +# ********* [FF] Environments ********* +std = [ + "alloc", + "getrandom?/std", + "rspace-traits/std", + "hashbrown?/default", + "num-complex?/std", + "num-traits/std", + "rand?/std", + "rand_distr?/std", + "serde?/std", + "serde_json?/std", + "thiserror/std", + "wasm-bindgen?/std", +] + +wasi = [ + "rspace-traits/wasi", +] + +wasm = [ + "wasm_bindgen", + "rspace-traits/wasm", + "getrandom?/wasm_js", +] + +# ********* [FF] Dependencies ********* +alloc = [ + "rspace-traits/alloc", + "hashbrown?/alloc", + "rand?/alloc", + "rand_distr?/alloc", + "serde?/alloc", + "serde_json?/alloc", + "wasm-bindgen?/gg-alloc", +] + +complex = ["dep:num-complex"] + +ndarray = [ + "rspace-traits/ndarray", +] + +hashbrown = [ + "dep:hashbrown", + "rspace-traits/hashbrown", +] + +rand = [ + "rng", + "dep:rand", + "dep:rand_distr", + "rspace-traits/rand", + "num-complex?/rand", +] + +rayon = [ + "rspace-traits/rayon", + "hashbrown?/rayon", +] + +rng = [ + "dep:getrandom", + "getrandom?/sys_rng", + "rand?/sys_rng", +] + +serde = [ + "dep:serde", + "dep:serde_derive", + "serde?/derive", + "hashbrown?/serde", + "num-complex?/serde", + "rand?/serde", + "rand_distr?/serde", + "rspace-traits/serde", +] + +serde_json = ["dep:serde_json"] + +wasm_bindgen = [ + "dep:wasm-bindgen", + "rspace-traits/wasm_bindgen", +] diff --git a/default.nix b/default.nix index e716a16..63eedae 100644 --- a/default.nix +++ b/default.nix @@ -26,7 +26,7 @@ let }; common = { - version = "0.0.9"; + version = "0.1.0"; src = self; cargoLock = { diff --git a/flake.nix b/flake.nix index 5c43b26..573e32f 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,7 @@ in rec { packages.default = pkgs.rustPlatform.buildRustPackage { pname = "rspace"; - version = "0.0.9"; + version = "0.1.0"; src = self; # ./.; cargoLock = { lockFile = ./Cargo.lock; diff --git a/rspace/examples/space.rs b/rspace/examples/space.rs index 8c5d290..a954c92 100644 --- a/rspace/examples/space.rs +++ b/rspace/examples/space.rs @@ -1,38 +1,38 @@ -/* - Appellation: space - Created At: 2025.12.26:18:23:32 - Contrib: @FL03 -*/ -use rspace::{Container, RawSpace}; - -fn main() -> rspace::Result<()> { - tracing_subscriber::fmt() - .with_ansi(true) - .with_file(false) - .with_line_number(false) - .with_max_level(tracing::Level::DEBUG) - .with_timer(tracing_subscriber::fmt::time::uptime()) - .init(); - - tracing::info! { "Welcome to rspace!" } - - let container = Something([1, 2, 3, 4, 5]); - tracing::info! { ?container } - - Ok(()) -} - -#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -#[repr(transparent)] -pub struct Something(pub T); - -impl RawSpace for Something { - type Elem = T; -} - -impl Container for Something<[T]> -where - [T]: RawSpace, -{ - type Cont = [V]; -} +/* + Appellation: space + Created At: 2025.12.26:18:23:32 + Contrib: @FL03 +*/ +use rspace::{Container, RawSpace}; + +fn main() -> rspace::Result<()> { + tracing_subscriber::fmt() + .with_ansi(true) + .with_file(false) + .with_line_number(false) + .with_max_level(tracing::Level::DEBUG) + .with_timer(tracing_subscriber::fmt::time::uptime()) + .init(); + + tracing::info! { "Welcome to {p}!", p = env!("CARGO_PKG_NAME") } + + let container = Something([1, 2, 3, 4, 5]); + tracing::info! { ?container } + + Ok(()) +} + +#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] +#[repr(transparent)] +pub struct Something(pub T); + +impl RawSpace for Something { + type Elem = T; +} + +impl Container for Something<[T]> +where + [T]: RawSpace, +{ + type Cont = [V]; +} diff --git a/traits/Cargo.toml b/traits/Cargo.toml index 10fb53e..ddf111b 100644 --- a/traits/Cargo.toml +++ b/traits/Cargo.toml @@ -1,106 +1,111 @@ -[package] -build = "build.rs" -description = "Traits and interfaces supporting the rspace framework" -name = "rspace-traits" - -authors.workspace = true -categories.workspace = true -edition.workspace = true -homepage.workspace = true -keywords.workspace = true -license.workspace = true -readme.workspace = true -repository.workspace = true -rust-version.workspace = true -version.workspace = true - -[package.metadata.docs.rs] -all-features = false -features = ["full"] -rustc-args = ["--cfg", "docsrs"] -version = "v{{version}}" - -[package.metadata.release] -no-dev-version = true -tag-name = "v{{version}}" - -[lib] -bench = false -crate-type = ["lib"] -doc = true -doctest = true -test = true - -[dependencies] -# data-structures -hashbrown = { optional = true, workspace = true } -ndarray = { optional = true, workspace = true } -# mathematics -num-complex = { optional = true, workspace = true } -num-traits = { workspace = true } -# macros and utilities -paste = { workspace = true } -# WebAssembly -wasm-bindgen = { optional = true, workspace = true } - -[features] -default = ["std"] - -full = [ - "default", - "complex", - "ndarray", - "hashbrown", - "rand", - "serde", -] - -# ********* [FF] Features ********* - -nightly = [ - "hashbrown?/nightly", -] - -# ********* [FF] Environments ********* - -std = [ - "alloc", - "hashbrown?/default", - "ndarray?/std", - "num-complex?/std", - "num-traits/std", -] - -wasi = [] - -wasm = [ - "wasm_bindgen", -] - -# ********* [FF] Dependencies ********* - -alloc = [ - "hashbrown?/alloc", -] - -complex = ["dep:num-complex"] - -hashbrown = ["dep:hashbrown"] - -ndarray = ["dep:ndarray"] - -rayon = [ - "hashbrown?/rayon", -] - -rand = [ - "num-complex?/rand", -] - -serde = [ - "hashbrown?/serde", - "ndarray?/serde", - "num-complex/serde", -] - -wasm_bindgen = ["dep:wasm-bindgen"] +[package] +build = "build.rs" +description = "Traits and interfaces supporting the rspace framework" +name = "rspace-traits" + +authors.workspace = true +categories.workspace = true +edition.workspace = true +homepage.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +repository.workspace = true +rust-version.workspace = true +version.workspace = true + +[package.metadata.docs.rs] +all-features = false +features = ["full"] +rustc-args = ["--cfg", "docsrs"] +version = "v{{version}}" + +[package.metadata.release] +no-dev-version = true +tag-name = "v{{version}}" + +[lib] +bench = false +crate-type = ["lib"] +doc = true +doctest = true +test = true + +[dependencies] +# data-structures +hashbrown = { optional = true, workspace = true } +ndarray = { optional = true, workspace = true } +# mathematics +num-complex = { optional = true, workspace = true } +num-traits = { workspace = true } +# macros and utilities +paste = { workspace = true } +# WebAssembly +wasm-bindgen = { optional = true, workspace = true } + +[features] +default = ["std"] + +full = [ + "default", + "complex", + "ndarray", + "hashbrown", + "rand", + "serde", +] + +# ********* [FF] Features ********* + +nightly = [ + "hashbrown?/nightly", +] + +# ********* [FF] Environments ********* + +std = [ + "alloc", + "hashbrown?/default", + "ndarray?/std", + "num-complex?/std", + "num-traits/std", + "wasm-bindgen?/std", +] + +wasi = [ + "default", +] + +wasm = [ + "default", + "wasm_bindgen", +] + +# ********* [FF] Dependencies ********* + +alloc = [ + "hashbrown?/alloc", + "wasm-bindgen?/gg-alloc", +] + +complex = ["dep:num-complex"] + +hashbrown = ["dep:hashbrown"] + +ndarray = ["dep:ndarray"] + +rayon = [ + "hashbrown?/rayon", +] + +rand = [ + "num-complex?/rand", +] + +serde = [ + "hashbrown?/serde", + "ndarray?/serde", + "num-complex/serde", +] + +wasm_bindgen = ["dep:wasm-bindgen"] diff --git a/traits/src/container.rs b/traits/src/container.rs index d600796..64cd406 100644 --- a/traits/src/container.rs +++ b/traits/src/container.rs @@ -14,15 +14,6 @@ where type Cont: ?Sized; } -pub trait ContainerIndex: Container -where - Self::Cont: RawSpace + core::ops::Index, -{ - type Output; - - fn get(&self, index: Idx) -> Option<&Self::Output>; -} - /// The [`ContainerIter`] trait extends the [`Container`] trait to provide an interface /// for obtaining iterators over the elements of the container. pub trait ContainerIter: Container diff --git a/traits/src/impls/impl_container.rs b/traits/src/impls/impl_container.rs index cfe5f5e..63a04a4 100644 --- a/traits/src/impls/impl_container.rs +++ b/traits/src/impls/impl_container.rs @@ -1,33 +1,33 @@ -/* - Appellation: impl_container - Created At: 2025.12.26:19:32:27 - Contrib: @FL03 -*/ -use crate::container::Container; -use crate::space::RawSpace; - -impl Container for S -where - S: RawSpace, -{ - type Cont = S; -} - -impl Container for [T] { - type Cont = [U]; -} - -#[allow(unused_macros)] -macro_rules! container { - (@impl $trait:ident<$T:ident> for $($cont:ident)::*<$($U:ident),+ $(,)?>) => { - paste::paste! { - impl<$($U),+> $trait<$T> for $($cont)::*<$($U),+> { - type Cont<[<_ $T>]> = $($cont)::*<[<_ $T>]>; - } - - } - }; - (impl $trait:ident<$T:ident> for {$($($cont:ident)::*<$($U:ident),+ $(,)?>),* $(,)?}) => { - $(container!{ @impl $trait<$T> for $($cont)::*<$($U),+>})* - }; -} +/* + Appellation: impl_container + Created At: 2025.12.26:19:32:27 + Contrib: @FL03 +*/ +use crate::container::Container; +use crate::space::RawSpace; + +impl Container for S +where + S: RawSpace, +{ + type Cont = S; +} + +impl Container for [T] { + type Cont = [U]; +} + +#[allow(unused_macros)] +macro_rules! container { + (@impl $trait:ident<$T:ident> for $($cont:ident)::*<$($U:ident),+ $(,)?>) => { + paste::paste! { + impl<$($U),+> $trait<$T> for $($cont)::*<$($U),+> { + type Cont<[<_ $T>]> = $($cont)::*<[<_ $T>]>; + } + + } + }; + (impl $trait:ident<$T:ident> for {$($($cont:ident)::*<$($U:ident),+ $(,)?>),* $(,)?}) => { + $(container!{ @impl $trait<$T> for $($cont)::*<$($U),+>})* + }; +} diff --git a/traits/src/impls/impl_space.rs b/traits/src/impls/impl_space.rs index bd172fd..faf5d5c 100644 --- a/traits/src/impls/impl_space.rs +++ b/traits/src/impls/impl_space.rs @@ -1,321 +1,321 @@ -/* - Appellation: impl_raw_space - Created At: 2025.12.26:19:20:09 - Contrib: @FL03 -*/ -use crate::{RawSpace, RawSpaceMut, RawSpaceRef, SliceSpace, SliceSpaceMut}; - -macro_rules! impl_scalar_space { - (impl $trait:ident for {$($T:ty),* $(,)?}) => { - $(impl_scalar_space! { @impl $trait for $T })* - }; - (@impl $trait:ident for $T:ty) => { - impl $crate::$trait for $T { - type Elem = $T; - - } - }; -} - -macro_rules! impl_raw_space { - (impl $trait:ident for {$( - $($cont:ident)::*<$($lt:lifetime,)? $($T:ident),*> $({where $($rest:tt)*})? - ),* $(,)?}) => { - $(impl_raw_space! { - @impl $trait for $($cont)::*<$($lt,)? $($T),*> $(where $($rest)*)? - })* - }; - (@impl $trait:ident for $($cont:ident)::*<$($lt:lifetime,)? $($T:ident),*> $(where $($rest:tt)*)?) => { - impl<$($lt,)? $($T),*> $crate::$trait for $($cont)::*<$($lt,)? $($T),*> $(where $($rest)*)? { - type Elem = $E; - } - }; -} - -macro_rules! impl_raw_tuple_store { - (@impl $trait:ident for ($($name:ident),+ $(,)?)) => { - impl<$E> $crate::$trait for ($($name),+) { - type Elem = $E; - } - }; - (impl $trait:ident for {$(($($name:ident),+)),* $(,)?}) => { - $(impl_raw_tuple_store! { @impl $trait for ($($name),+) } )* - }; -} - -impl_scalar_space! { - impl RawSpace for { - i8, i16, i32, i64, i128, isize, - u8, u16, u32, u64, u128, usize, - f32, f64, - bool, char - } -} - -#[cfg(feature = "alloc")] -impl_scalar_space! { - impl RawSpace for { - alloc::string::String - } -} - -impl_raw_tuple_store! { - impl RawSpace for { - (T, T), - (T, T, T), - (T, T, T, T), - (T, T, T, T, T), - (T, T, T, T, T, T), - (T, T, T, T, T, T, T), - (T, T, T, T, T, T, T, T), - (T, T, T, T, T, T, T, T, T), - (T, T, T, T, T, T, T, T, T, T), - (T, T, T, T, T, T, T, T, T, T, T), - (T, T, T, T, T, T, T, T, T, T, T, T), - } -} - -impl_raw_space! { - impl RawSpace for { - core::option::Option, - core::cell::Cell, - core::cell::OnceCell, - core::cell::RefCell, - core::cell::UnsafeCell, - core::ops::Range, - core::result::Result, - } -} - -#[cfg(all(feature = "alloc", not(feature = "nightly")))] -impl_raw_space! { - impl RawSpace for { - alloc::boxed::Box, - alloc::rc::Rc, - alloc::sync::Arc, - alloc::collections::BTreeSet, - alloc::collections::LinkedList, - alloc::collections::VecDeque, - alloc::collections::BinaryHeap, - alloc::collections::BTreeMap, - alloc::collections::btree_map::Entry<'a, K, T>, - alloc::vec::Vec, - } -} - -#[cfg(all(feature = "alloc", feature = "nightly"))] -impl_raw_space! { - impl RawSpace for { - alloc::collections::BTreeSet { where A: Clone + alloc::alloc::Allocator }, - alloc::collections::LinkedList { where A: alloc::alloc::Allocator }, - alloc::collections::VecDeque { where A: alloc::alloc::Allocator }, - alloc::collections::BinaryHeap { where A: alloc::alloc::Allocator }, - alloc::collections::BTreeMap { where A: Clone + alloc::alloc::Allocator }, - alloc::collections::btree_map::Entry<'a, K, T, A> { where A: Clone + alloc::alloc::Allocator }, - alloc::vec::Vec { where A: alloc::alloc::Allocator }, - } -} - -#[cfg(feature = "std")] -impl_raw_space! { - impl RawSpace for { - std::sync::Mutex, - std::sync::RwLock, - std::sync::LazyLock, - std::collections::HashMap, - std::collections::HashSet, - } -} - -#[cfg(feature = "hashbrown")] -impl_raw_space! { - impl RawSpace for { - hashbrown::HashMap, - hashbrown::HashSet, - } -} - -#[cfg(feature = "ndarray")] -impl_raw_space! { - impl RawSpace for { - ndarray::ArrayBase { where S: ndarray::Data, D: ndarray::Dimension }, - } -} - -#[cfg(feature = "complex")] -impl RawSpace for num_complex::Complex { - type Elem = T; -} - -impl RawSpace for [T] { - type Elem = T; -} - -impl RawSpace for &[T] { - type Elem = T; -} - -impl RawSpace for &mut [T] { - type Elem = T; -} - -impl RawSpace for [T; N] { - type Elem = T; -} - -impl RawSpaceRef for [T; N] { - fn as_ptr(&self) -> *const Self::Elem { - <[T]>::as_ptr(self) - } -} - -impl RawSpaceMut for [T; N] { - fn as_ptr_mut(&mut self) -> *mut Self::Elem { - <[T]>::as_mut_ptr(self) - } -} - -impl SliceSpace for [T; N] { - fn as_slice(&self) -> &[Self::Elem] { - self - } -} - -impl SliceSpaceMut for [T; N] { - fn as_mut_slice(&mut self) -> &mut [Self::Elem] { - self - } -} - -impl RawSpaceRef for [T] { - fn as_ptr(&self) -> *const Self::Elem { - <[T]>::as_ptr(self) - } -} - -impl RawSpaceMut for [T] { - fn as_ptr_mut(&mut self) -> *mut Self::Elem { - <[T]>::as_mut_ptr(self) - } -} - -impl SliceSpace for [T] { - fn as_slice(&self) -> &[Self::Elem] { - self - } -} - -impl SliceSpaceMut for [T] { - fn as_mut_slice(&mut self) -> &mut [Self::Elem] { - self - } -} - -impl RawSpaceRef for &[T] { - fn as_ptr(&self) -> *const Self::Elem { - <[T]>::as_ptr(self) - } -} - -impl SliceSpace for &[T] { - fn as_slice(&self) -> &[Self::Elem] { - self - } -} - -impl RawSpaceRef for &mut [T] { - fn as_ptr(&self) -> *const Self::Elem { - <[T]>::as_ptr(self) - } -} - -impl RawSpaceMut for &mut [T] { - fn as_ptr_mut(&mut self) -> *mut Self::Elem { - <[T]>::as_mut_ptr(self) - } -} - -impl SliceSpace for &mut [T] { - fn as_slice(&self) -> &[Self::Elem] { - self - } -} - -impl SliceSpaceMut for &mut [T] { - fn as_mut_slice(&mut self) -> &mut [Self::Elem] { - self - } -} - -#[cfg(all(feature = "alloc", feature = "nightly"))] -mod impl_alloc { - use crate::space::*; - use alloc::alloc::Allocator; - use alloc::vec::Vec; - - impl RawSpaceRef for Vec - where - A: Allocator, - { - fn as_ptr(&self) -> *const Self::Elem { - Vec::as_ptr(self) - } - } - - impl RawSpaceMut for Vec - where - A: Allocator, - { - fn as_ptr_mut(&mut self) -> *mut Self::Elem { - Vec::as_mut_ptr(self) - } - } - - impl SliceSpace for Vec - where - A: Allocator, - { - fn as_slice(&self) -> &[Self::Elem] { - self.as_slice() - } - } - - impl SliceSpaceMut for Vec - where - A: Allocator, - { - fn as_mut_slice(&mut self) -> &mut [Self::Elem] { - self.as_mut_slice() - } - } -} - -#[cfg(all(feature = "alloc", not(feature = "nightly")))] -mod impl_alloc { - use crate::space::*; - use alloc::vec::Vec; - - impl RawSpaceRef for Vec { - fn as_ptr(&self) -> *const Self::Elem { - Vec::as_ptr(self) - } - } - - impl RawSpaceMut for Vec { - fn as_ptr_mut(&mut self) -> *mut Self::Elem { - Vec::as_mut_ptr(self) - } - } - - impl SliceSpace for Vec { - fn as_slice(&self) -> &[Self::Elem] { - self.as_slice() - } - } - - impl SliceSpaceMut for Vec { - fn as_mut_slice(&mut self) -> &mut [Self::Elem] { - self.as_mut_slice() - } - } -} +/* + Appellation: impl_raw_space + Created At: 2025.12.26:19:20:09 + Contrib: @FL03 +*/ +use crate::{RawSpace, RawSpaceMut, RawSpaceRef, SliceSpace, SliceSpaceMut}; + +macro_rules! impl_scalar_space { + (impl $trait:ident for {$($T:ty),* $(,)?}) => { + $(impl_scalar_space! { @impl $trait for $T })* + }; + (@impl $trait:ident for $T:ty) => { + impl $crate::$trait for $T { + type Elem = $T; + + } + }; +} + +macro_rules! impl_raw_space { + (impl $trait:ident for {$( + $($cont:ident)::*<$($lt:lifetime,)? $($T:ident),*> $({where $($rest:tt)*})? + ),* $(,)?}) => { + $(impl_raw_space! { + @impl $trait for $($cont)::*<$($lt,)? $($T),*> $(where $($rest)*)? + })* + }; + (@impl $trait:ident for $($cont:ident)::*<$($lt:lifetime,)? $($T:ident),*> $(where $($rest:tt)*)?) => { + impl<$($lt,)? $($T),*> $crate::$trait for $($cont)::*<$($lt,)? $($T),*> $(where $($rest)*)? { + type Elem = $E; + } + }; +} + +macro_rules! impl_raw_tuple_store { + (@impl $trait:ident for ($($name:ident),+ $(,)?)) => { + impl<$E> $crate::$trait for ($($name),+) { + type Elem = $E; + } + }; + (impl $trait:ident for {$(($($name:ident),+)),* $(,)?}) => { + $(impl_raw_tuple_store! { @impl $trait for ($($name),+) } )* + }; +} + +impl_scalar_space! { + impl RawSpace for { + i8, i16, i32, i64, i128, isize, + u8, u16, u32, u64, u128, usize, + f32, f64, + bool, char + } +} + +#[cfg(feature = "alloc")] +impl_scalar_space! { + impl RawSpace for { + alloc::string::String + } +} + +impl_raw_tuple_store! { + impl RawSpace for { + (T, T), + (T, T, T), + (T, T, T, T), + (T, T, T, T, T), + (T, T, T, T, T, T), + (T, T, T, T, T, T, T), + (T, T, T, T, T, T, T, T), + (T, T, T, T, T, T, T, T, T), + (T, T, T, T, T, T, T, T, T, T), + (T, T, T, T, T, T, T, T, T, T, T), + (T, T, T, T, T, T, T, T, T, T, T, T), + } +} + +impl_raw_space! { + impl RawSpace for { + core::option::Option, + core::cell::Cell, + core::cell::OnceCell, + core::cell::RefCell, + core::cell::UnsafeCell, + core::ops::Range, + core::result::Result, + } +} + +#[cfg(all(feature = "alloc", not(feature = "nightly")))] +impl_raw_space! { + impl RawSpace for { + alloc::boxed::Box, + alloc::rc::Rc, + alloc::sync::Arc, + alloc::collections::BTreeSet, + alloc::collections::LinkedList, + alloc::collections::VecDeque, + alloc::collections::BinaryHeap, + alloc::collections::BTreeMap, + alloc::collections::btree_map::Entry<'a, K, T>, + alloc::vec::Vec, + } +} + +#[cfg(all(feature = "alloc", feature = "nightly"))] +impl_raw_space! { + impl RawSpace for { + alloc::collections::BTreeSet { where A: Clone + alloc::alloc::Allocator }, + alloc::collections::LinkedList { where A: alloc::alloc::Allocator }, + alloc::collections::VecDeque { where A: alloc::alloc::Allocator }, + alloc::collections::BinaryHeap { where A: alloc::alloc::Allocator }, + alloc::collections::BTreeMap { where A: Clone + alloc::alloc::Allocator }, + alloc::collections::btree_map::Entry<'a, K, T, A> { where A: Clone + alloc::alloc::Allocator }, + alloc::vec::Vec { where A: alloc::alloc::Allocator }, + } +} + +#[cfg(feature = "std")] +impl_raw_space! { + impl RawSpace for { + std::sync::Mutex, + std::sync::RwLock, + std::sync::LazyLock, + std::collections::HashMap, + std::collections::HashSet, + } +} + +#[cfg(feature = "hashbrown")] +impl_raw_space! { + impl RawSpace for { + hashbrown::HashMap, + hashbrown::HashSet, + } +} + +#[cfg(feature = "ndarray")] +impl_raw_space! { + impl RawSpace for { + ndarray::ArrayBase { where S: ndarray::Data, D: ndarray::Dimension }, + } +} + +#[cfg(feature = "complex")] +impl RawSpace for num_complex::Complex { + type Elem = T; +} + +impl RawSpace for [T] { + type Elem = T; +} + +impl RawSpace for &[T] { + type Elem = T; +} + +impl RawSpace for &mut [T] { + type Elem = T; +} + +impl RawSpace for [T; N] { + type Elem = T; +} + +impl RawSpaceRef for [T; N] { + fn as_ptr(&self) -> *const Self::Elem { + <[T]>::as_ptr(self) + } +} + +impl RawSpaceMut for [T; N] { + fn as_ptr_mut(&mut self) -> *mut Self::Elem { + <[T]>::as_mut_ptr(self) + } +} + +impl SliceSpace for [T; N] { + fn as_slice(&self) -> &[Self::Elem] { + self + } +} + +impl SliceSpaceMut for [T; N] { + fn as_mut_slice(&mut self) -> &mut [Self::Elem] { + self + } +} + +impl RawSpaceRef for [T] { + fn as_ptr(&self) -> *const Self::Elem { + <[T]>::as_ptr(self) + } +} + +impl RawSpaceMut for [T] { + fn as_ptr_mut(&mut self) -> *mut Self::Elem { + <[T]>::as_mut_ptr(self) + } +} + +impl SliceSpace for [T] { + fn as_slice(&self) -> &[Self::Elem] { + self + } +} + +impl SliceSpaceMut for [T] { + fn as_mut_slice(&mut self) -> &mut [Self::Elem] { + self + } +} + +impl RawSpaceRef for &[T] { + fn as_ptr(&self) -> *const Self::Elem { + <[T]>::as_ptr(self) + } +} + +impl SliceSpace for &[T] { + fn as_slice(&self) -> &[Self::Elem] { + self + } +} + +impl RawSpaceRef for &mut [T] { + fn as_ptr(&self) -> *const Self::Elem { + <[T]>::as_ptr(self) + } +} + +impl RawSpaceMut for &mut [T] { + fn as_ptr_mut(&mut self) -> *mut Self::Elem { + <[T]>::as_mut_ptr(self) + } +} + +impl SliceSpace for &mut [T] { + fn as_slice(&self) -> &[Self::Elem] { + self + } +} + +impl SliceSpaceMut for &mut [T] { + fn as_mut_slice(&mut self) -> &mut [Self::Elem] { + self + } +} + +#[cfg(all(feature = "alloc", feature = "nightly"))] +mod impl_alloc { + use crate::space::*; + use alloc::alloc::Allocator; + use alloc::vec::Vec; + + impl RawSpaceRef for Vec + where + A: Allocator, + { + fn as_ptr(&self) -> *const Self::Elem { + Vec::as_ptr(self) + } + } + + impl RawSpaceMut for Vec + where + A: Allocator, + { + fn as_ptr_mut(&mut self) -> *mut Self::Elem { + Vec::as_mut_ptr(self) + } + } + + impl SliceSpace for Vec + where + A: Allocator, + { + fn as_slice(&self) -> &[Self::Elem] { + self.as_slice() + } + } + + impl SliceSpaceMut for Vec + where + A: Allocator, + { + fn as_mut_slice(&mut self) -> &mut [Self::Elem] { + self.as_mut_slice() + } + } +} + +#[cfg(all(feature = "alloc", not(feature = "nightly")))] +mod impl_alloc { + use crate::space::*; + use alloc::vec::Vec; + + impl RawSpaceRef for Vec { + fn as_ptr(&self) -> *const Self::Elem { + Vec::as_ptr(self) + } + } + + impl RawSpaceMut for Vec { + fn as_ptr_mut(&mut self) -> *mut Self::Elem { + Vec::as_mut_ptr(self) + } + } + + impl SliceSpace for Vec { + fn as_slice(&self) -> &[Self::Elem] { + self.as_slice() + } + } + + impl SliceSpaceMut for Vec { + fn as_mut_slice(&mut self) -> &mut [Self::Elem] { + self.as_mut_slice() + } + } +} diff --git a/traits/src/ops/get.rs b/traits/src/ops/get.rs index 19c97dc..bd42577 100644 --- a/traits/src/ops/get.rs +++ b/traits/src/ops/get.rs @@ -1,77 +1,87 @@ -/* - Appellation: get - Created At: 2025.12.29:15:17:51 - Contrib: @FL03 -*/ - -/// [`Get`] defines an interface for entities that can be accessed by a key; the design is -/// similar to the [`Index`](core::ops::Index) trait in the standard library, however, uses the -/// [`Borrow`](core::borrow::Borrow) trait to allow for more flexible key types. -pub trait Get { - type Key; - type Value: ?Sized; - /// returns a reference to the element at the specified index. - fn get(&self, index: Q) -> Option<&Self::Value> - where - Self::Key: core::borrow::Borrow; -} -/// [`GetMut`] defines an interface for entities that can be accessed by a key; the design -/// is similar to the [`IndexMut`](core::ops::IndexMut) trait in the standard library -pub trait GetMut: Get { - /// returns a mutable reference to the element at the specified index. - fn get_mut(&mut self, index: Q) -> Option<&mut Self::Value> - where - Self::Key: core::borrow::Borrow; -} - -/* - ************* Implementations ************* -*/ - -impl Get for &U -where - U: Get, -{ - type Key = U::Key; - type Value = U::Value; - - fn get(&self, index: Q) -> Option<&Y> - where - Self::Key: core::borrow::Borrow, - { - (*self).get(index) - } -} - -impl Get for [T] -where - Q: core::slice::SliceIndex<[T]>, -{ - type Key = usize; - type Value = Q::Output; - - fn get(&self, index: Q) -> Option<&Self::Value> - where - Self::Key: core::borrow::Borrow, - { - self.as_ref().get(index) - } -} - -#[cfg(feature = "hashbrown")] -impl Get for hashbrown::HashMap -where - Q: Eq + core::hash::Hash, - K: Eq + core::hash::Hash, - S: core::hash::BuildHasher, -{ - type Key = K; - type Value = V; - - fn get(&self, index: Q) -> Option<&V> - where - Self::Key: core::borrow::Borrow, - { - self.get(&index) - } -} +/* + Appellation: get + Created At: 2025.12.29:15:17:51 + Contrib: @FL03 +*/ +use crate::{Container, RawSpace}; + +pub trait Getter: Container +where + Self::Cont: RawSpace + core::ops::Index, +{ + type Output; + + fn get(&self, index: Idx) -> Option<&Self::Output>; +} + +/// [`Get`] defines an interface for entities that can be accessed by a key; the design is +/// similar to the [`Index`](core::ops::Index) trait in the standard library, however, uses the +/// [`Borrow`](core::borrow::Borrow) trait to allow for more flexible key types. +pub trait Get { + type Key; + type Value: ?Sized; + /// returns a reference to the element at the specified index. + fn get(&self, index: Q) -> Option<&Self::Value> + where + Self::Key: core::borrow::Borrow; +} +/// [`GetMut`] defines an interface for entities that can be accessed by a key; the design +/// is similar to the [`IndexMut`](core::ops::IndexMut) trait in the standard library +pub trait GetMut: Get { + /// returns a mutable reference to the element at the specified index. + fn get_mut(&mut self, index: Q) -> Option<&mut Self::Value> + where + Self::Key: core::borrow::Borrow; +} + +/* + ************* Implementations ************* +*/ + +impl Get for &U +where + U: Get, +{ + type Key = U::Key; + type Value = U::Value; + + fn get(&self, index: Q) -> Option<&Y> + where + Self::Key: core::borrow::Borrow, + { + (*self).get(index) + } +} + +impl Get for [T] +where + Q: core::slice::SliceIndex<[T]>, +{ + type Key = usize; + type Value = Q::Output; + + fn get(&self, index: Q) -> Option<&Self::Value> + where + Self::Key: core::borrow::Borrow, + { + self.as_ref().get(index) + } +} + +#[cfg(feature = "hashbrown")] +impl Get for hashbrown::HashMap +where + Q: Eq + core::hash::Hash, + K: Eq + core::hash::Hash, + S: core::hash::BuildHasher, +{ + type Key = K; + type Value = V; + + fn get(&self, index: Q) -> Option<&V> + where + Self::Key: core::borrow::Borrow, + { + self.get(&index) + } +} diff --git a/traits/src/space.rs b/traits/src/space.rs index 974fe01..40cceab 100644 --- a/traits/src/space.rs +++ b/traits/src/space.rs @@ -1,91 +1,91 @@ -/* - Appellation: space - Created At: 2025.12.26:14:12:46 - Contrib: @FL03 -*/ -//! This module defines the [`RawSpace`] trait alongside other interfaces for immutable and -//! mutable access to the inner elements of a container. - -/// The [`RawSpace`] trait is used to define a base interface for all containers whose elements -/// are of **one** specific type. -pub trait RawSpace { - /// The type of elements associated with the space - type Elem; -} -/// [`ScalarSpace`] defins a type of space that consists of a single element. This trait is -/// useful in that it generally allows for a tensor-like treatment of scalar values within -/// more complex mathematical structures. -pub trait ScalarSpace: RawSpace { - private! {} -} -/// [`RawSpaceRef`] is a trait that provides various read-only methods for accessing elements. -pub trait RawSpaceRef: RawSpace { - fn as_ptr(&self) -> *const Self::Elem; -} -/// [`RawSpaceMut`] is a trait that provides various mutable methods for accessing elements. -pub trait RawSpaceMut: RawSpace { - /// returns a mutable pointer to the element currently within scope - fn as_ptr_mut(&mut self) -> *mut Self::Elem; -} - -/// [`SliceSpace`] is used to define sequential collections, spaces, or containers that can be -/// viewed as slices. -pub trait SliceSpace: RawSpaceRef { - fn as_slice(&self) -> &[Self::Elem]; - - fn len(&self) -> usize { - self.as_slice().len() - } - - fn is_empty(&self) -> bool { - self.len() == 0 - } -} -/// [`SliceSpaceMut`] is used to define sequential collections, spaces, or containers that can be -pub trait SliceSpaceMut: SliceSpace + RawSpaceMut { - /// returns a mutable slice of the elements - fn as_mut_slice(&mut self) -> &mut [Self::Elem]; -} - -/* - ************* Implementations ************* -*/ - -impl ScalarSpace for T -where - T: RawSpace, -{ - seal! {} -} - -impl RawSpace for &C -where - C: RawSpace, -{ - type Elem = C::Elem; -} - -impl RawSpace for &mut C -where - C: RawSpace, -{ - type Elem = C::Elem; -} - -impl RawSpaceRef for &U -where - U: RawSpaceRef, -{ - fn as_ptr(&self) -> *const Self::Elem { - U::as_ptr(*self) - } -} - -impl RawSpaceRef for &mut U -where - U: RawSpaceRef, -{ - fn as_ptr(&self) -> *const Self::Elem { - U::as_ptr(*self) - } -} +/* + Appellation: space + Created At: 2025.12.26:14:12:46 + Contrib: @FL03 +*/ +//! This module defines the [`RawSpace`] trait alongside other interfaces for immutable and +//! mutable access to the inner elements of a container. + +/// The [`RawSpace`] trait is used to define a base interface for all containers whose elements +/// are of **one** specific type. +pub trait RawSpace { + /// The type of elements associated with the space + type Elem; +} +/// [`ScalarSpace`] defins a type of space that consists of a single element. This trait is +/// useful in that it generally allows for a tensor-like treatment of scalar values within +/// more complex mathematical structures. +pub trait ScalarSpace: RawSpace { + private! {} +} +/// [`RawSpaceRef`] is a trait that provides various read-only methods for accessing elements. +pub trait RawSpaceRef: RawSpace { + fn as_ptr(&self) -> *const Self::Elem; +} +/// [`RawSpaceMut`] is a trait that provides various mutable methods for accessing elements. +pub trait RawSpaceMut: RawSpace { + /// returns a mutable pointer to the element currently within scope + fn as_ptr_mut(&mut self) -> *mut Self::Elem; +} + +/// [`SliceSpace`] is used to define sequential collections, spaces, or containers that can be +/// viewed as slices. +pub trait SliceSpace: RawSpaceRef { + fn as_slice(&self) -> &[Self::Elem]; + + fn len(&self) -> usize { + self.as_slice().len() + } + + fn is_empty(&self) -> bool { + self.len() == 0 + } +} +/// [`SliceSpaceMut`] is used to define sequential collections, spaces, or containers that can be +pub trait SliceSpaceMut: SliceSpace + RawSpaceMut { + /// returns a mutable slice of the elements + fn as_mut_slice(&mut self) -> &mut [Self::Elem]; +} + +/* + ************* Implementations ************* +*/ + +impl ScalarSpace for T +where + T: RawSpace, +{ + seal! {} +} + +impl RawSpace for &C +where + C: RawSpace, +{ + type Elem = C::Elem; +} + +impl RawSpace for &mut C +where + C: RawSpace, +{ + type Elem = C::Elem; +} + +impl RawSpaceRef for &U +where + U: RawSpaceRef, +{ + fn as_ptr(&self) -> *const Self::Elem { + U::as_ptr(*self) + } +} + +impl RawSpaceRef for &mut U +where + U: RawSpaceRef, +{ + fn as_ptr(&self) -> *const Self::Elem { + U::as_ptr(*self) + } +}