From 65bb1f1823172f30da033abca388c9bf435e3ccc Mon Sep 17 00:00:00 2001 From: erius Date: Sun, 26 May 2024 22:57:00 +0300 Subject: [PATCH] Moved yew web project into another repo, removed sq_matrix module --- Cargo.lock | 1143 +----------------------- Cargo.toml | 12 +- Trunk.toml | 6 - math/Cargo.toml | 7 - math/src/lib.rs | 2 - math/src/sq_matrix.rs | 48 - src/lib.rs | 1 + {math/src => src}/matrix.rs | 38 +- {math/src => src}/matrix/arithemtic.rs | 65 +- {math/src => src}/matrix/iter.rs | 0 {math/src => src}/matrix/ops.rs | 6 +- web/Cargo.toml | 12 - web/assets/favicon.ico | Bin 15406 -> 0 bytes web/index.html | 11 - web/index.scss | 29 - web/src/main.rs | 18 - web/src/matrix.rs | 105 --- 17 files changed, 64 insertions(+), 1439 deletions(-) delete mode 100644 Trunk.toml delete mode 100644 math/Cargo.toml delete mode 100644 math/src/lib.rs delete mode 100644 math/src/sq_matrix.rs create mode 100644 src/lib.rs rename {math/src => src}/matrix.rs (95%) rename {math/src => src}/matrix/arithemtic.rs (80%) rename {math/src => src}/matrix/iter.rs (100%) rename {math/src => src}/matrix/ops.rs (94%) delete mode 100644 web/Cargo.toml delete mode 100644 web/assets/favicon.ico delete mode 100644 web/index.html delete mode 100644 web/index.scss delete mode 100644 web/src/main.rs delete mode 100644 web/src/matrix.rs diff --git a/Cargo.lock b/Cargo.lock index 06fbc78..ac37eb0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,27 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "anymap2" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c" - [[package]] name = "autocfg" version = "1.3.0" @@ -30,629 +9,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] -name = "backtrace" -version = "0.3.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "bytes" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" - -[[package]] -name = "cc" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] - -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" - -[[package]] -name = "gloo" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28999cda5ef6916ffd33fb4a7b87e1de633c47c0dc6d97905fee1cdaa142b94d" -dependencies = [ - "gloo-console 0.2.3", - "gloo-dialogs 0.1.1", - "gloo-events 0.1.2", - "gloo-file 0.2.3", - "gloo-history 0.1.5", - "gloo-net 0.3.1", - "gloo-render 0.1.1", - "gloo-storage 0.2.2", - "gloo-timers 0.2.6", - "gloo-utils 0.1.7", - "gloo-worker 0.2.1", -] - -[[package]] -name = "gloo" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd35526c28cc55c1db77aed6296de58677dbab863b118483a27845631d870249" -dependencies = [ - "gloo-console 0.3.0", - "gloo-dialogs 0.2.0", - "gloo-events 0.2.0", - "gloo-file 0.3.0", - "gloo-history 0.2.2", - "gloo-net 0.4.0", - "gloo-render 0.2.0", - "gloo-storage 0.3.0", - "gloo-timers 0.3.0", - "gloo-utils 0.2.0", - "gloo-worker 0.4.0", -] - -[[package]] -name = "gloo-console" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f" -dependencies = [ - "gloo-utils 0.1.7", - "js-sys", - "serde", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-console" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a17868f56b4a24f677b17c8cb69958385102fa879418052d60b50bc1727e261" -dependencies = [ - "gloo-utils 0.2.0", - "js-sys", - "serde", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-dialogs" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6" -dependencies = [ - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-dialogs" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4748e10122b01435750ff530095b1217cf6546173459448b83913ebe7815df" -dependencies = [ - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-events" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc" -dependencies = [ - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-events" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27c26fb45f7c385ba980f5fa87ac677e363949e065a083722697ef1b2cc91e41" -dependencies = [ - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-file" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7" -dependencies = [ - "gloo-events 0.1.2", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-file" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97563d71863fb2824b2e974e754a81d19c4a7ec47b09ced8a0e6656b6d54bd1f" -dependencies = [ - "gloo-events 0.2.0", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-history" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85725d90bf0ed47063b3930ef28e863658a7905989e9929a8708aab74a1d5e7f" -dependencies = [ - "gloo-events 0.1.2", - "gloo-utils 0.1.7", - "serde", - "serde-wasm-bindgen 0.5.0", - "serde_urlencoded", - "thiserror", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-history" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "903f432be5ba34427eac5e16048ef65604a82061fe93789f2212afc73d8617d6" -dependencies = [ - "getrandom", - "gloo-events 0.2.0", - "gloo-utils 0.2.0", - "serde", - "serde-wasm-bindgen 0.6.5", - "serde_urlencoded", - "thiserror", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-net" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66b4e3c7d9ed8d315fd6b97c8b1f74a7c6ecbbc2320e65ae7ed38b7068cc620" -dependencies = [ - "futures-channel", - "futures-core", - "futures-sink", - "gloo-utils 0.1.7", - "http", - "js-sys", - "pin-project", - "serde", - "serde_json", - "thiserror", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "gloo-net" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ac9e8288ae2c632fa9f8657ac70bfe38a1530f345282d7ba66a1f70b72b7dc4" -dependencies = [ - "futures-channel", - "futures-core", - "futures-sink", - "gloo-utils 0.2.0", - "http", - "js-sys", - "pin-project", - "serde", - "serde_json", - "thiserror", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "gloo-render" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764" -dependencies = [ - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-render" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56008b6744713a8e8d98ac3dcb7d06543d5662358c9c805b4ce2167ad4649833" -dependencies = [ - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-storage" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480" -dependencies = [ - "gloo-utils 0.1.7", - "js-sys", - "serde", - "serde_json", - "thiserror", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-storage" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc8031e8c92758af912f9bc08fbbadd3c6f3cfcbf6b64cdf3d6a81f0139277a" -dependencies = [ - "gloo-utils 0.2.0", - "js-sys", - "serde", - "serde_json", - "thiserror", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-timers" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "gloo-timers" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "gloo-utils" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037fcb07216cb3a30f7292bd0176b050b7b9a052ba830ef7d5d65f6dc64ba58e" -dependencies = [ - "js-sys", - "serde", - "serde_json", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-utils" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5555354113b18c547c1d3a98fbf7fb32a9ff4f6fa112ce823a21641a0ba3aa" -dependencies = [ - "js-sys", - "serde", - "serde_json", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-worker" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13471584da78061a28306d1359dd0178d8d6fc1c7c80e5e35d27260346e0516a" -dependencies = [ - "anymap2", - "bincode", - "gloo-console 0.2.3", - "gloo-utils 0.1.7", - "js-sys", - "serde", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "gloo-worker" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76495d3dd87de51da268fa3a593da118ab43eb7f8809e17eb38d3319b424e400" -dependencies = [ - "bincode", - "futures", - "gloo-utils 0.2.0", - "gloo-worker-macros", - "js-sys", - "pinned", - "serde", - "thiserror", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "gloo-worker-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956caa58d4857bc9941749d55e4bd3000032d8212762586fa5705632967140e7" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "implicit-clone" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8a9aa791c7b5a71b636b7a68207fdebf171ddfc593d9c8506ec4cbc527b6a84" -dependencies = [ - "implicit-clone-derive", - "indexmap", -] - -[[package]] -name = "implicit-clone-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9311685eb9a34808bbb0608ad2fcab9ae216266beca5848613e95553ac914e3b" -dependencies = [ - "quote", - "syn 2.0.65", -] - -[[package]] -name = "indexmap" -version = "2.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" -dependencies = [ - "equivalent", - "hashbrown", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "js-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "libc" -version = "0.2.155" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" - -[[package]] -name = "log" -version = "0.4.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" - -[[package]] -name = "math" +name = "mathematical" version = "0.1.0" dependencies = [ "num", ] -[[package]] -name = "memchr" -version = "2.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" - -[[package]] -name = "miniz_oxide" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" -dependencies = [ - "adler", -] - [[package]] name = "num" version = "0.4.3" @@ -725,506 +87,3 @@ checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pinned" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a829027bd95e54cfe13e3e258a1ae7b645960553fb82b75ff852c29688ee595b" -dependencies = [ - "futures", - "rustversion", - "thiserror", -] - -[[package]] -name = "prettyplease" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" -dependencies = [ - "proc-macro2", - "syn 2.0.65", -] - -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "prokio" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b55e106e5791fa5a13abd13c85d6127312e8e09098059ca2bc9b03ca4cf488" -dependencies = [ - "futures", - "gloo 0.8.1", - "num_cpus", - "once_cell", - "pin-project", - "pinned", - "tokio", - "tokio-stream", - "wasm-bindgen-futures", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustversion" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "serde" -version = "1.0.202" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-wasm-bindgen" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e" -dependencies = [ - "js-sys", - "serde", - "wasm-bindgen", -] - -[[package]] -name = "serde-wasm-bindgen" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b" -dependencies = [ - "js-sys", - "serde", - "wasm-bindgen", -] - -[[package]] -name = "serde_derive" -version = "1.0.202" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "serde_json" -version = "1.0.117" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "thiserror" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "tokio" -version = "1.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" -dependencies = [ - "backtrace", - "pin-project-lite", -] - -[[package]] -name = "tokio-stream" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml_datetime" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.65", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" - -[[package]] -name = "web" -version = "0.1.0" -dependencies = [ - "math", - "yew", -] - -[[package]] -name = "web-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - -[[package]] -name = "yew" -version = "0.21.0" -source = "git+https://github.com/yewstack/yew/#dbdd3b78e1f0aada1834dec5c6ee83449db9d220" -dependencies = [ - "console_error_panic_hook", - "futures", - "gloo 0.10.0", - "implicit-clone", - "indexmap", - "js-sys", - "prokio", - "rustversion", - "serde", - "slab", - "thiserror", - "tokio", - "tracing", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "yew-macro", -] - -[[package]] -name = "yew-macro" -version = "0.21.0" -source = "git+https://github.com/yewstack/yew/#dbdd3b78e1f0aada1834dec5c6ee83449db9d220" -dependencies = [ - "once_cell", - "prettyplease", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.65", -] diff --git a/Cargo.toml b/Cargo.toml index 6d6a558..dd7d7b7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,7 @@ -[workspace] -resolver = "2" -members = [ - "math", "web" -] +[package] +name = "mathematical" +version = "0.1.0" +edition = "2021" + +[dependencies] +num = "0.4.3" diff --git a/Trunk.toml b/Trunk.toml deleted file mode 100644 index ef290d5..0000000 --- a/Trunk.toml +++ /dev/null @@ -1,6 +0,0 @@ -[build] -target = "web/index.html" - -[serve] -address = "127.0.0.1" -port = 8080 diff --git a/math/Cargo.toml b/math/Cargo.toml deleted file mode 100644 index 1b3de5c..0000000 --- a/math/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "math" -version = "0.1.0" -edition = "2021" - -[dependencies] -num = "0.4.3" diff --git a/math/src/lib.rs b/math/src/lib.rs deleted file mode 100644 index aecb370..0000000 --- a/math/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod matrix; -pub mod sq_matrix; diff --git a/math/src/sq_matrix.rs b/math/src/sq_matrix.rs deleted file mode 100644 index 6a684f4..0000000 --- a/math/src/sq_matrix.rs +++ /dev/null @@ -1,48 +0,0 @@ -use num::Num; -use super::matrix::Matrix; - -pub struct SquareMatrix { - matrix: Matrix -} - -impl SquareMatrix { - pub fn order(&self) -> usize { - self.matrix.width() - } - - pub fn new(mut data: Vec, order: usize) -> Self { - let size = check_size(order); - data.truncate(size); - Self { - matrix: Matrix::new_unchecked(data, order) - } - } -} - -impl SquareMatrix { - pub fn new_filled(val: T, order: usize) -> Self { - let size = check_size(order); - let data = vec![val; size]; - Self { - matrix: Matrix::new_unchecked(data, order) - } - } -} - -fn check_size(order: usize) -> usize { - if order < 2 { - panic!("Square matrix must have at least order of 2, but got {}", order) - } - let Some(size) = order.checked_mul(order) - else { - panic!("Total matrix size for order {} exceeds usize limit", order) - }; - return size; -} - -#[macro_export] -macro_rules! sq_matrix { - [ $o:expr; $( $x:expr ),+ ] => { - $crate::matrix::SquareMatrix::new(vec![$( $x, )+], $o) - }; -} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..3bb3506 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1 @@ +pub mod matrix; diff --git a/math/src/matrix.rs b/src/matrix.rs similarity index 95% rename from math/src/matrix.rs rename to src/matrix.rs index 097e235..04db490 100644 --- a/math/src/matrix.rs +++ b/src/matrix.rs @@ -1,6 +1,6 @@ mod iter; -mod arithemtic; mod ops; +mod arithemtic; use std::ops::{Index, IndexMut}; @@ -12,7 +12,7 @@ pub struct Matrix { data: Box> } -impl Matrix { +impl Matrix { pub fn new_filled(val: T, width: usize, height: usize) -> Self { let Some(size) = width.checked_mul(height) else { @@ -34,7 +34,7 @@ impl Matrix { } pub fn column(&self, j: usize) -> Vec { - self.iter_column(j).copied().collect() + self.iter_column(j).cloned().collect() } pub fn append_row_zeroes(&mut self) { @@ -44,19 +44,6 @@ impl Matrix { pub fn append_column_zeroes(&mut self) { self.append_column(vec![T::zero(); self.height()]) } - - pub fn remove_row(&mut self, i: usize) { - if self.height() <= 2 { - panic!("Unable to remove row of a matrix with height {}", self.height()); - } - let row_start = i * self.width; - self.data.copy_within(row_start+self.width.., row_start); - self.data.truncate(self.data.len() - self.width); - } - - pub fn remove_last_row(&mut self) { - self.remove_row(self.height() - 1); - } } impl Matrix { @@ -73,10 +60,6 @@ impl Matrix { Self { width, data: Box::new(data) } } - pub(super) fn new_unchecked(data: Vec, width: usize) -> Self { - Self { width, data: Box::new(data) } - } - pub fn width(&self) -> usize { self.width } @@ -116,6 +99,21 @@ impl Matrix { self.width += 1; } + pub fn remove_row(&mut self, i: usize) { + if self.height() <= 2 { + panic!("Unable to remove row of a matrix with height {}", self.height()); + } + let row_start = i * self.width; + self.data.drain(row_start..row_start+self.width); + } + + pub fn remove_last_row(&mut self) { + if self.height() <= 2 { + panic!("Unable to remove row of a matrix with height {}", self.height()); + } + self.data.truncate(self.data.len() - self.width); + } + pub fn remove_column(&mut self, j: usize) { if self.width <= 2 { panic!("Unable to remove column of a matrix with height {}", self.width); diff --git a/math/src/matrix/arithemtic.rs b/src/matrix/arithemtic.rs similarity index 80% rename from math/src/matrix/arithemtic.rs rename to src/matrix/arithemtic.rs index fa92df4..9103301 100644 --- a/math/src/matrix/arithemtic.rs +++ b/src/matrix/arithemtic.rs @@ -4,7 +4,7 @@ use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssi use num::{traits::NumAssign, Num, Signed}; -impl Matrix { +impl Matrix { pub fn multiply(&self, rhs: &Self) -> Self { if !self.can_mul(&rhs) { panic!("Unable to multiply matrices with sizes {}x{} and {}x{}", @@ -12,9 +12,9 @@ impl Matrix { } let mut new = Matrix::new_zeroes(rhs.width, self.height()); for (i, j) in new.indices() { - let new_elem = self.row(i).into_iter() - .zip(rhs.column(j).into_iter()) - .map(|(e1, e2)| e1 * e2) + let new_elem = self[i].iter() + .zip(rhs.iter_column(j)) + .map(|(e1, e2)| e1.clone() * e2.clone()) .reduce(|acc, e| acc + e); new[i][j] = new_elem.unwrap(); } @@ -22,7 +22,7 @@ impl Matrix { } } -impl Add for Matrix { +impl Add for Matrix { type Output = Self; fn add(self, rhs: Self) -> Self::Output { if !self.same_size(&rhs) { @@ -38,7 +38,7 @@ impl Add for Matrix { } } -impl AddAssign for Matrix { +impl AddAssign for Matrix { fn add_assign(&mut self, rhs: Self) { if !self.same_size(&rhs) { panic!("Unable to add matrices with different sizes {}x{} and {}x{}", @@ -50,17 +50,18 @@ impl AddAssign for Matrix { } } -impl Neg for Matrix { +impl Neg for Matrix { type Output = Self; - fn neg(mut self) -> Self::Output { - for e in self.iter_mut() { - *e = -*e; - } - return self; + fn neg(self) -> Self::Output { + let width = self.width; + let data = self.into_iter() + .map(|e| -e) + .collect(); + return Self { data: Box::new(data), width }; } } -impl Sub for Matrix { +impl Sub for Matrix { type Output = Self; fn sub(self, rhs: Self) -> Self::Output { if !self.same_size(&rhs) { @@ -76,7 +77,7 @@ impl Sub for Matrix { } } -impl SubAssign for Matrix { +impl SubAssign for Matrix { fn sub_assign(&mut self, rhs: Self) { if !self.same_size(&rhs) { panic!("Unable to subtract matrices with different sizes {}x{} and {}x{}", @@ -88,43 +89,45 @@ impl SubAssign for Matrix { } } -impl Mul for Matrix { +impl Mul for Matrix { type Output = Self; - fn mul(mut self, rhs: T) -> Self::Output { - for e in self.iter_mut() { - *e = *e * rhs; - } - return self; + fn mul(self, rhs: T) -> Self::Output { + let width = self.width; + let data = self.into_iter() + .map(|e| e * rhs.clone()) + .collect(); + return Self { data: Box::new(data), width }; } } -impl MulAssign for Matrix { +impl MulAssign for Matrix { fn mul_assign(&mut self, rhs: T) { for e in self.iter_mut() { - *e *= rhs; + *e *= rhs.clone(); } } } -impl Div for Matrix { +impl Div for Matrix { type Output = Self; - fn div(mut self, rhs: T) -> Self::Output { - for e in self.iter_mut() { - *e = *e / rhs; - } - return self; + fn div(self, rhs: T) -> Self::Output { + let width = self.width; + let data = self.into_iter() + .map(|e| e / rhs.clone()) + .collect(); + return Self { data: Box::new(data), width }; } } -impl DivAssign for Matrix { +impl DivAssign for Matrix { fn div_assign(&mut self, rhs: T) { for e in self.iter_mut() { - *e /= rhs; + *e /= rhs.clone(); } } } -impl Mul for Matrix { +impl Mul for Matrix { type Output = Self; fn mul(self, rhs: Self) -> Self::Output { self.multiply(&rhs) diff --git a/math/src/matrix/iter.rs b/src/matrix/iter.rs similarity index 100% rename from math/src/matrix/iter.rs rename to src/matrix/iter.rs diff --git a/math/src/matrix/ops.rs b/src/matrix/ops.rs similarity index 94% rename from math/src/matrix/ops.rs rename to src/matrix/ops.rs index 3cbfc32..d449db8 100644 --- a/math/src/matrix/ops.rs +++ b/src/matrix/ops.rs @@ -2,7 +2,7 @@ use super::*; use num::Num; -impl Matrix { +impl Matrix { pub fn minor(&self, row_index: usize, column_index: usize) -> Self { if self.width < 2 { panic!("Matrix width must be greater than 1 to form its minor, but got {}", self.width) @@ -18,7 +18,7 @@ impl Matrix { let mut minor_data = Box::new(Vec::with_capacity(minor_width * (height - 1))); for (i, j, e) in self.iter_indexed() { if i == row_index || j == column_index { continue; } - minor_data.push(*e); + minor_data.push(e.clone()); } Self { width: minor_width, data: minor_data } } @@ -29,7 +29,7 @@ impl Matrix { for j in 0..self.width { let mut row_start = 0usize; for _ in 0..height { - transposed_data.push(self.data[row_start + j]); + transposed_data.push(self.data[row_start + j].clone()); row_start += self.width; } } diff --git a/web/Cargo.toml b/web/Cargo.toml deleted file mode 100644 index ae2abcb..0000000 --- a/web/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "web" -version = "0.1.0" -edition = "2021" - -[dependencies] -math = { path = "../math" } -log = "0.4.21" -wasm-bindgen = "0.2.92" -wasm-logger = "0.2.0" -web-sys = "0.3.69" -yew = { git = "https://github.com/yewstack/yew/", features = ["csr"] } diff --git a/web/assets/favicon.ico b/web/assets/favicon.ico deleted file mode 100644 index 3f2c5bf5409ed826cdbe727a077e8c06c5957eb8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15406 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 - - - - Mathematical - - - - - - diff --git a/web/index.scss b/web/index.scss deleted file mode 100644 index 20c0552..0000000 --- a/web/index.scss +++ /dev/null @@ -1,29 +0,0 @@ -$bg-color: #2b2927; -$text-color: #e2e19c; -$cell-color: #473b34; - -body { - background-color: $bg-color; - color: $text-color; -} - -.matrix { - display: grid; - gap: 50px; - grid-template-columns: auto 100px; - grid-template-rows: auto 100px; - justify-content: start; - - input { - background-color: $cell-color; - color: $text-color; - border: solid 1px black; - width: 30pt; - } - - button { - background-color: $cell-color; - color: $text-color; - border: solid 1px black; - } -} diff --git a/web/src/main.rs b/web/src/main.rs deleted file mode 100644 index 79bfef9..0000000 --- a/web/src/main.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod matrix; - -use yew::prelude::*; -use matrix::MatrixComponent; - -#[function_component] -fn App() -> Html { - html! { - <> - - - } -} - -fn main() { - wasm_logger::init(wasm_logger::Config::default()); - yew::Renderer::::new().render(); -} diff --git a/web/src/matrix.rs b/web/src/matrix.rs deleted file mode 100644 index 5bce0a2..0000000 --- a/web/src/matrix.rs +++ /dev/null @@ -1,105 +0,0 @@ -use math::matrix::Matrix; -use yew::prelude::*; -use web_sys::HtmlInputElement; -use wasm_bindgen::JsCast; - -pub enum MatrixMsg { - CellChange(Cell), - AddRow, - AddColumn, - RemoveRow, - RemoveColumn -} - -#[derive(PartialEq, Clone, Copy)] -pub struct Cell { - i: usize, j: usize, value: i32 -} - -pub struct MatrixComponent { - matrix: Matrix -} - -impl Component for MatrixComponent { - type Message = MatrixMsg; - type Properties = (); - - fn create(_ctx: &Context) -> Self { - Self { matrix: Matrix::new_zeroes(3, 3) } - } - - fn update(&mut self, _ctx: &Context, msg: Self::Message) -> bool { - match msg { - MatrixMsg::CellChange(cell) => self.matrix[cell.i][cell.j] = cell.value, - MatrixMsg::AddRow => self.matrix.append_row_zeroes(), - MatrixMsg::AddColumn => self.matrix.append_column_zeroes(), - MatrixMsg::RemoveRow => { - if self.matrix.height() > 2 { - self.matrix.remove_last_row(); - } - }, - MatrixMsg::RemoveColumn => { - if self.matrix.width() > 2 { - self.matrix.remove_last_column(); - } - } - } - return true; - } - - fn view(&self, ctx: &Context) -> Html { - let on_size_change = ctx.link().callback(|msg| msg); - log::info!("{:?}", &self.matrix); - html! { -
- { - self.matrix.iter_rows().enumerate().map(|(i, row)| html! { - { - row.iter().enumerate().map(|(j, e)| { - let oninput = ctx.link().callback(move |e: InputEvent| { - let input = e.target().unwrap().unchecked_into::(); - let value = input.value().trim().parse::().unwrap_or_default(); - log::info!("{}", value); - MatrixMsg::CellChange(Cell { i, j, value }) - }); - html! { - - } - }).collect::() - } - - }).collect::() - } -
- -
- -
- } - } -} - -#[derive(PartialEq, Properties)] -pub struct MatrixSizeControlsProps { - on_size_change: Callback -} - -#[function_component] -pub fn MatrixSizeControls(props: &MatrixSizeControlsProps) -> Html { - let on_click_add_row = props.on_size_change.reform(|_| MatrixMsg::AddRow); - let on_click_add_column = props.on_size_change.reform(|_| MatrixMsg::AddColumn); - let on_click_remove_row = props.on_size_change.reform(|_|MatrixMsg::RemoveRow); - let on_click_remove_column = props.on_size_change.reform(|_| MatrixMsg::RemoveColumn); - html! { -
-
- - -
-
- - -
-
- } -}