changed inputs for second section and implemented Clone and Copy traits for Alignment data structure

This commit is contained in:
doryan 2024-04-14 20:13:15 +04:00
parent 5687d6773a
commit 48057646a8
11 changed files with 399 additions and 433 deletions

262
Cargo.lock generated
View File

@ -19,21 +19,21 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "anyhow"
version = "1.0.75"
version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519"
[[package]]
name = "autocfg"
version = "1.1.0"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
[[package]]
name = "backtrace"
version = "0.3.69"
version = "0.3.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d"
dependencies = [
"addr2line",
"cc",
@ -46,9 +46,9 @@ dependencies = [
[[package]]
name = "bitflags"
version = "2.4.1"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
[[package]]
name = "bitvec"
@ -64,9 +64,9 @@ dependencies = [
[[package]]
name = "cairo-rs"
version = "0.19.2"
version = "0.19.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2650f66005301bd33cc486dec076e1293c4cecf768bc7ba9bf5d2b1be339b99c"
checksum = "b2ac2a4d0e69036cf0062976f6efcba1aaee3e448594e6514bb2ddf87acce562"
dependencies = [
"bitflags",
"cairo-sys-rs",
@ -88,18 +88,15 @@ dependencies = [
[[package]]
name = "cc"
version = "1.0.83"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
dependencies = [
"libc",
]
checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7"
[[package]]
name = "cfg-expr"
version = "0.15.5"
version = "0.15.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03915af431787e6ffdcc74c645077518c6b6e01f80b761e0fbbfa288536311b3"
checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02"
dependencies = [
"smallvec",
"target-lexicon",
@ -135,24 +132,24 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
[[package]]
name = "futures-channel"
version = "0.3.29"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb"
checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
dependencies = [
"futures-core",
]
[[package]]
name = "futures-core"
version = "0.3.29"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c"
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
[[package]]
name = "futures-executor"
version = "0.3.29"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc"
checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d"
dependencies = [
"futures-core",
"futures-task",
@ -161,32 +158,32 @@ dependencies = [
[[package]]
name = "futures-io"
version = "0.3.29"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa"
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
[[package]]
name = "futures-macro"
version = "0.3.29"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb"
checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.39",
"syn 2.0.58",
]
[[package]]
name = "futures-task"
version = "0.3.29"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2"
checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
[[package]]
name = "futures-util"
version = "0.3.29"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104"
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
dependencies = [
"futures-core",
"futures-macro",
@ -255,15 +252,15 @@ dependencies = [
[[package]]
name = "gimli"
version = "0.28.0"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
[[package]]
name = "gio"
version = "0.19.2"
version = "0.19.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2eae10b27b6dd27e22ed0d812c6387deba295e6fc004a8b379e459b663b05a02"
checksum = "3f91a0518c2ec539f099d3f945ab2d6a83ec372a9ef40a21906343b191182845"
dependencies = [
"futures-channel",
"futures-core",
@ -292,9 +289,9 @@ dependencies = [
[[package]]
name = "glib"
version = "0.19.2"
version = "0.19.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab9e86540b5d8402e905ad4ce7d6aa544092131ab564f3102175af176b90a053"
checksum = "ae1407b2ce171e654720be10d57d4054d3ff2f10a13d5b37e6819b41439832f7"
dependencies = [
"bitflags",
"futures-channel",
@ -314,15 +311,15 @@ dependencies = [
[[package]]
name = "glib-macros"
version = "0.19.2"
version = "0.19.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f5897ca27a83e4cdc7b4666850bade0a2e73e17689aabafcc9acddad9d823b8"
checksum = "d8bba315e8ce8aa59631545358450f4962557e89b5f7db7442e7153b47037f71"
dependencies = [
"heck",
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.39",
"syn 2.0.58",
]
[[package]]
@ -456,27 +453,27 @@ dependencies = [
[[package]]
name = "hashbrown"
version = "0.14.2"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
[[package]]
name = "heck"
version = "0.4.1"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hermit-abi"
version = "0.3.3"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
[[package]]
name = "indexmap"
version = "2.1.0"
version = "2.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
dependencies = [
"equivalent",
"hashbrown",
@ -526,30 +523,30 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.150"
version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "memchr"
version = "2.7.1"
version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "memoffset"
version = "0.9.0"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
dependencies = [
"autocfg",
]
[[package]]
name = "miniz_oxide"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7"
dependencies = [
"adler",
]
@ -566,18 +563,18 @@ dependencies = [
[[package]]
name = "object"
version = "0.32.1"
version = "0.32.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
dependencies = [
"memchr",
]
[[package]]
name = "pango"
version = "0.19.2"
version = "0.19.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7809e8af4df8d024a066106b72ca6bc7253a484ae3867041a96103ef8a13188d"
checksum = "b1264d13deb823cc652f26cfe59afb1ec4b9db2a5bd27c41b738c879cc1bfaa1"
dependencies = [
"gio",
"glib",
@ -599,9 +596,9 @@ dependencies = [
[[package]]
name = "pin-project-lite"
version = "0.2.13"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
[[package]]
name = "pin-utils"
@ -621,7 +618,7 @@ version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284"
dependencies = [
"toml_edit",
"toml_edit 0.21.1",
]
[[package]]
@ -650,18 +647,18 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.69"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.33"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
dependencies = [
"proc-macro2",
]
@ -689,35 +686,35 @@ dependencies = [
[[package]]
name = "semver"
version = "1.0.20"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090"
checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
[[package]]
name = "serde"
version = "1.0.193"
version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89"
checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.193"
version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.39",
"syn 2.0.58",
]
[[package]]
name = "serde_spanned"
version = "0.6.4"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80"
checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1"
dependencies = [
"serde",
]
@ -733,9 +730,9 @@ dependencies = [
[[package]]
name = "smallvec"
version = "1.13.1"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "syn"
@ -750,9 +747,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.39"
version = "2.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687"
dependencies = [
"proc-macro2",
"quote",
@ -761,9 +758,9 @@ dependencies = [
[[package]]
name = "system-deps"
version = "6.2.0"
version = "6.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a2d580ff6a20c55dfb86be5f9c238f67835d0e81cbdea8bf5680e0897320331"
checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349"
dependencies = [
"cfg-expr",
"heck",
@ -780,35 +777,35 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]]
name = "target-lexicon"
version = "0.12.12"
version = "0.12.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a"
checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
[[package]]
name = "thiserror"
version = "1.0.50"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.50"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.39",
"syn 2.0.58",
]
[[package]]
name = "tokio"
version = "1.34.0"
version = "1.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9"
checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
dependencies = [
"backtrace",
"num_cpus",
@ -824,19 +821,19 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.39",
"syn 2.0.58",
]
[[package]]
name = "toml"
version = "0.8.8"
version = "0.8.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35"
checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
"toml_edit 0.22.9",
]
[[package]]
@ -850,15 +847,26 @@ dependencies = [
[[package]]
name = "toml_edit"
version = "0.21.0"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03"
checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
dependencies = [
"indexmap",
"toml_datetime",
"winnow 0.5.40",
]
[[package]]
name = "toml_edit"
version = "0.22.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
"winnow 0.6.6",
]
[[package]]
@ -869,9 +877,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "version-compare"
version = "0.1.1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29"
checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b"
[[package]]
name = "version_check"
@ -890,13 +898,14 @@ dependencies = [
[[package]]
name = "windows-targets"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b"
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
@ -905,51 +914,66 @@ dependencies = [
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9"
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675"
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
[[package]]
name = "windows_i686_gnu"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3"
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
[[package]]
name = "windows_i686_msvc"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02"
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03"
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177"
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.4"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
[[package]]
name = "winnow"
version = "0.5.19"
version = "0.5.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b"
checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
dependencies = [
"memchr",
]
[[package]]
name = "winnow"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352"
dependencies = [
"memchr",
]

View File

@ -1,30 +1,29 @@
use crate::{
model::model::*,
gtk::{
*,
prelude::*
},
};
use crate::{gtk::prelude::*, model::model::*};
impl<F, C> EventHandler<F, C>
where F: Fn(&C) + FnOnce(&C) + FnMut(&C){
pub fn new(component: C, callback: F) -> EventHandler<F, C>{
Self{
where
F: Fn(&C) + FnOnce(&C) + FnMut(&C),
{
pub fn new(component: C, callback: F) -> EventHandler<F, C> {
Self {
component,
callback,
}
}
}
pub trait BtnEventHandler{
pub trait BtnEventHandler {
fn on_click(self) -> ();
}
impl<F, C> BtnEventHandler for EventHandler<F, C>
where F: Fn(&C) + FnOnce(&C) + FnMut(&C) + 'static, C: ButtonExt + WidgetExt{
where
F: Fn(&C) + FnOnce(&C) + FnMut(&C) + 'static,
C: ButtonExt + WidgetExt,
{
fn on_click(self) -> () {
self.component.connect_clicked(move |button| {
(self.callback)(button)
});
self.component
.connect_clicked(move |button| (self.callback)(button));
}
}
}

View File

@ -1,9 +1,6 @@
use std::{borrow::Borrow, collections::HashMap};
use std::collections::HashMap;
use crate::{
model::model::*,
controller::view_utils::input_utils::*,
};
use crate::{controller::view_utils::input_utils::*, model::model::*};
/// **Синдромы**
///
@ -21,21 +18,17 @@ use crate::{
///
/// ошибочная позиция 7 false false false.
pub fn hamming(raw_input: String, mode: HammingMode) -> Result<String, String>{
pub fn hamming(raw_input: String, mode: HammingMode) -> Result<String, String> {
let length_of_code: usize = mode.clone() as usize;
let length_of_code : usize = mode.clone() as usize;
let prepared_input : String = processing_input(&raw_input);
let prepared_input: String = processing_input(&raw_input);
let (fc, sc) = check_correct_input(&raw_input, &prepared_input, length_of_code);
if !fc || !sc {
Err("Ошибка. Проверьте корректность ввода.".to_string())
} else {
let mut data : String = String::new();
let mut data: String = String::new();
let prepared_data: Vec<u8> = from_string_to_vec_bits(prepared_input);
@ -45,103 +38,90 @@ pub fn hamming(raw_input: String, mode: HammingMode) -> Result<String, String>{
}
return Ok(data);
}
}
pub fn hamming_encrypt_data(
data: &Vec<u8>,
result_string: &mut String,
length_of_code: usize
) {
let mut i : usize = length_of_code;
while i <= data.len(){
pub fn hamming_encrypt_data(data: &Vec<u8>, result_string: &mut String, length_of_code: usize) {
let mut i: usize = length_of_code;
while i <= data.len() {
let data_bits = &data[i - length_of_code..i];
let (check_bit_1, check_bit_2, check_bit_3) = (
data_bits[0] ^ data_bits[1] ^ data_bits[3],
data_bits[0] ^ data_bits[2] ^ data_bits[3],
data_bits[1] ^ data_bits[2] ^ data_bits[3]
data_bits[1] ^ data_bits[2] ^ data_bits[3],
);
result_string.push_str(&*format!("{check_bit_1}{}{check_bit_2}{}{check_bit_3}{}{} ",
data_bits[0],
data_bits[1],
data_bits[2],
data_bits[3]));
result_string.push_str(&*format!(
"{check_bit_1}{}{check_bit_2}{}{check_bit_3}{}{} ",
data_bits[0], data_bits[1], data_bits[2], data_bits[3]
));
i += length_of_code;
}
}
pub fn hamming_decrypt_data(
data: &Vec<u8>,
result_string: &mut String,
length_of_code: usize
) {
pub fn hamming_decrypt_data(data: &Vec<u8>, result_string: &mut String, length_of_code: usize) {
let mut general_length: usize = length_of_code;
let mut i : usize = length_of_code;
let syndromes: HashMap<usize, (bool, bool, bool)> = HashMap::from([
(1, (false, true, true)),
(2, (false, false, true)),
(3, (true, false, true)),
(4, (false, true, false)),
(5, (true, true, false)),
(6, (true, false, false)),
(7, (false, false, false)),
]);
let syndromes : HashMap<usize, (bool, bool, bool)> = HashMap::from(
[
(1, (false, true, true)),
(2, (false, false, true)),
(3, (true, false, true)),
(4, (false, true, false)),
(5, (true, true, false)),
(6, (true, false, false)),
(7, (false, false, false)),
]
);
let mut errors: String = String::new();
let mut errors : String = String::new();
while general_length <= data.len() {
let data_bits = &data[general_length - length_of_code..general_length];
while i <= data.len(){
let mut data_bits = &data[i - length_of_code..i];
let checked_bits : (bool, bool, bool) =
(
(data_bits[1] ^ data_bits[3] ^ data_bits[6]) == data_bits[0],
(data_bits[1] ^ data_bits[5] ^ data_bits[6]) == data_bits[2],
(data_bits[3] ^ data_bits[5] ^ data_bits[6]) == data_bits[4]
);
let checked_bits: (bool, bool, bool) = (
(data_bits[1] ^ data_bits[3] ^ data_bits[6]) == data_bits[0],
(data_bits[1] ^ data_bits[5] ^ data_bits[6]) == data_bits[2],
(data_bits[3] ^ data_bits[5] ^ data_bits[6]) == data_bits[4],
);
match checked_bits {
(true, true, true) => {
i += length_of_code;
general_length += length_of_code;
continue;
},
}
_ => {
let error_position = syndromes
.iter()
.find(move |&(&error_position, &error)| error == checked_bits).
unwrap().0;
.find(move |&(&_error_position, &error)| error == checked_bits)
.unwrap()
.0;
let correctly_code : Vec<u8> = data_bits
let correctly_code: Vec<u8> = data_bits
.iter()
.enumerate()
.map(|(index, bit)| {
if index == error_position - 1 {
if *bit == 1u8 { 0u8 } else { 1u8 }
} else {
*bit
}
}).collect();
if index == error_position - 1 {
if *bit == 1u8 {
0u8
} else {
1u8
}
} else {
*bit
}
})
.collect();
let error = format!("Ошибка в коде {} {:?}, позиция ошибки {}, корректный код: {:?}; \n",
i / 7,
&data_bits,
error_position,
correctly_code
let error = format!(
"Ошибка в коде {} {:?}, позиция ошибки {}, корректный код: {:?}; \n",
general_length / 7,
&data_bits,
error_position,
correctly_code
);
errors.push_str(error.as_str());
i += length_of_code;
general_length += length_of_code;
}
}
}
@ -151,5 +131,4 @@ pub fn hamming_decrypt_data(
} else {
result_string.push_str(errors.as_str())
}
}
}

View File

@ -1,24 +1,19 @@
extern crate core;
use gtk4 as gtk;
use gtk::*;
use gtk::prelude::*;
mod view;
mod model;
mod controller;
mod model;
mod view;
use controller::*;
use view::view::*;
fn main() {
let app = adw::Application::builder()
.application_id("com.github.gtk-rs.examples.basic")
.build();
app.connect_activate(ui);
app.run();
}
}

View File

@ -1,19 +1,16 @@
use gtk4 as gtk;
use crate::{
view::properties::*,
model::builder_traits::*
};
use gtk::{*, prelude::*};
use crate::{model::builder_traits::*, view::properties::*};
use gtk::{prelude::*, *};
pub type InputLabel = String;
pub struct Input {
component: Box
component: Box,
}
pub struct InputBuilder {
align: Align,
align: Alignment,
label: InputLabel,
margins: MarginData,
}
@ -21,7 +18,10 @@ pub struct InputBuilder {
impl Product<InputBuilder, Box> for Input {
fn builder() -> InputBuilder {
InputBuilder {
align: Align::Start,
align: Alignment {
horizontal: Align::Start,
vertical: Align::Start,
},
label: String::new(),
margins: MarginData::EqualsMargin(5),
}
@ -33,37 +33,30 @@ impl Product<InputBuilder, Box> for Input {
}
impl InputBuilder {
pub fn set_label(mut self, label: &str) -> Self {
self.label = String::from(label);
self
}
pub fn set_align(mut self, align: Align) -> Self {
pub fn set_align(mut self, align: Alignment) -> Self {
self.align = align;
self
}
pub fn set_margins(mut self, margin: MarginData) -> Self {
self.margins = margin;
self
}
pub fn build(self, monospace: bool, wrap_mode: WrapMode, input_height: i32) -> Input {
let input_component = Box::new(Orientation::Vertical, 0);
let input_label = Label::builder()
.halign(self.align)
.halign(self.align.horizontal)
.valign(self.align.vertical)
.set_margin(self.margins)
.label(self.label)
.build();
@ -84,9 +77,8 @@ impl InputBuilder {
input_component.append(&text_view_input_frame);
Input {
component: input_component
component: input_component,
}
}
}
}

View File

@ -1,31 +1,24 @@
use std::ops::Deref;
use gtk4 as gtk;
#[allow(unused)]
use gtk::{
Box,
Stack,
Widget,
Orientation,
StackSidebar,
StackSwitcher,
StackTransitionType,
prelude::{BoxExt, IsA},
Box, Orientation, Stack, StackSidebar, StackSwitcher, StackTransitionType, Widget,
};
use crate::view::components::builder_traits::{Builder, Product};
pub type Page<'a> = (&'a str, &'a str, &'a Box);
pub struct Pages{
wrapper: Box
pub struct Pages {
wrapper: Box,
}
pub struct PagesBuilder{
pub struct PagesBuilder {
pages_content: Stack,
}
impl Product<PagesBuilder, Box> for Pages {
fn builder() -> PagesBuilder {
PagesBuilder {
pages_content: Stack::new(),
@ -35,11 +28,9 @@ impl Product<PagesBuilder, Box> for Pages {
fn get(self) -> Box {
self.wrapper
}
}
impl Builder<Pages, Page<'_>, i32> for PagesBuilder{
impl Builder<Pages, Page<'_>, i32> for PagesBuilder {
fn build(&self, build_param: i32) -> Pages {
let stack_sidebar = StackSidebar::new();
let stack_switcher = StackSwitcher::new();
@ -52,9 +43,7 @@ impl Builder<Pages, Page<'_>, i32> for PagesBuilder{
wrapper.append(&stack_sidebar);
wrapper.append(&self.pages_content);
Pages{
wrapper
}
Pages { wrapper }
}
fn append_item(self, item: Page) -> Self {
@ -70,27 +59,18 @@ impl Builder<Pages, Page<'_>, i32> for PagesBuilder{
self
}
}
impl PagesBuilder {
fn append_page_private(
&self,
item: Page
) {
fn append_page_private(&self, item: Page) {
self.pages_content.add_titled(item.2, Some(item.1), item.0);
}
pub fn set_transition(
self,
type_transition : StackTransitionType,
duration: u32
) -> Self {
pub fn set_transition(self, type_transition: StackTransitionType, duration: u32) -> Self {
self.pages_content.set_transition_type(type_transition);
self.pages_content.set_transition_duration(duration);
self
}
}
}

View File

@ -1,7 +1,7 @@
use gtk4 as gtk;
use gtk::{Notebook, Label, Box};
use super::builder_traits::*;
use gtk::{Box, Label, Notebook};
pub type TabLabel = Label;
pub type TabContent = Box;
@ -9,43 +9,32 @@ pub type TabPage<'a> = (&'a str, TabContent);
#[derive(Clone)]
pub struct TabsBuilder {
tabs: Vec<(TabLabel, TabContent)>
tabs: Vec<(TabLabel, TabContent)>,
}
pub struct Tabs {
tabs_wrapper: Notebook
tabs_wrapper: Notebook,
}
impl Product<TabsBuilder, Notebook> for Tabs {
fn builder() -> TabsBuilder {
TabsBuilder {
tabs: Vec::new(),
}
TabsBuilder { tabs: Vec::new() }
}
fn get(self) -> Notebook {
self.tabs_wrapper
}
}
impl Builder<Tabs, TabPage<'_>, &str> for TabsBuilder{
impl Builder<Tabs, TabPage<'_>, &str> for TabsBuilder {
fn build(&self, build_param: &str) -> Tabs {
let tabs_wrapper = Notebook::builder()
.group_name(build_param)
.build();
let tabs_wrapper = Notebook::builder().group_name(build_param).build();
self.tabs
.iter()
.for_each(|(label, content)| {
tabs_wrapper.append_page(content, Some(label));
});
self.tabs.iter().for_each(|(label, content)| {
tabs_wrapper.append_page(content, Some(label));
});
Tabs {
tabs_wrapper
}
Tabs { tabs_wrapper }
}
fn append_item(mut self, item: TabPage) -> Self {
@ -55,21 +44,18 @@ impl Builder<Tabs, TabPage<'_>, &str> for TabsBuilder{
}
fn append_items(mut self, items: Vec<TabPage>) -> Self {
for item in items{
for item in items {
self.append_tab_private(item);
}
self
}
}
impl TabsBuilder {
fn append_tab_private(&mut self, item: TabPage) {
let tab_label = Label::new(Some(item.0));
self.tabs.push((tab_label, item.1));
}
}
}

View File

@ -1,29 +1,18 @@
use gtk4 as gtk;
use crate::{
model::model::*,
view::{
properties::*,
components::{
*,
switch::*,
wrapper::*,
}
},
controller::{
controller::*,
event_handlers::{button_event_handlers::*, switch_event_handlers::*},
view_utils::input_utils::*,
event_handlers::{
button_event_handlers::*,
switch_event_handlers::*,
},
}
},
model::model::*,
view::{components::wrapper::*, properties::*},
};
use gtk::{*, prelude::*};
pub fn hamming_code_page(wrapper: &Box) -> (){
use gtk::{prelude::*, *};
pub fn hamming_code_page(wrapper: &Box) -> () {
// input
let hamming_text_view_input_label = Label::builder()
@ -67,11 +56,10 @@ pub fn hamming_code_page(wrapper: &Box) -> (){
// interactive panel
let clear_input_button =
Button::builder()
.set_align(Alignment::new(Align::Fill, Align::Fill))
.label("Очистка полей")
.build();
let clear_input_button = Button::builder()
.set_align(Alignment::new(Align::Fill, Align::Fill))
.label("Очистка полей")
.build();
let hamming_crypt_button = Button::builder()
.set_align(Alignment::new(Align::Fill, Align::Fill))
@ -80,9 +68,7 @@ pub fn hamming_code_page(wrapper: &Box) -> (){
let crypt_mode_switch = Switch::new();
let crypt_mode_label = Label::builder()
.label("Режим: кодирование")
.build();
let crypt_mode_label = Label::builder().label("Режим: кодирование").build();
// references for binding actions
@ -99,28 +85,27 @@ pub fn hamming_code_page(wrapper: &Box) -> (){
// actions
EventHandler::new(
clear_input_button_to_handle,
move |_| {
clearing(&text_view_input_for_clearing, &text_view_output_for_clearing);
}
).on_click();
EventHandler::new(clear_input_button_to_handle, move |_| {
clearing(
&text_view_input_for_clearing,
&text_view_output_for_clearing,
);
})
.on_click();
EventHandler::new(
hamming_crypt_button.clone(),
move |button: &Button| {
parse_input(
&text_view_input_for_parse,
&text_view_output_for_output,
crypt_mode_switch_to_handle.state()
)
}).on_click();
EventHandler::new(hamming_crypt_button.clone(), move |_button: &Button| {
parse_input(
&text_view_input_for_parse,
&text_view_output_for_output,
crypt_mode_switch_to_handle.state(),
)
})
.on_click();
EventHandler::new(
crypt_mode_switch.clone(),
move |s : &Switch| {
state_controller(s, &crypt_mode_label_to_handle);
}).on_toggle();
EventHandler::new(crypt_mode_switch.clone(), move |s: &Switch| {
state_controller(s, &crypt_mode_label_to_handle);
})
.on_toggle();
// wrappers
@ -148,5 +133,4 @@ pub fn hamming_code_page(wrapper: &Box) -> (){
wrapper.append(&interactive_components_wrapper);
wrapper.append(&hamming_text_view_output_label);
wrapper.append(&hamming_text_view_output_frame);
}
}

View File

@ -1,78 +1,107 @@
use gtk4 as gtk;
use gtk::{*, prelude::*};
use crate::model::builder_traits::Product;
use crate::view::{
properties::*,
components::{
wrapper::*,
input::Input,
use crate::{
model::builder_traits::Product,
view::{
components::{input::Input, wrapper::Wrapper},
properties::*,
},
};
use gtk::{prelude::*, Align, WrapMode, *};
pub fn signal_reducing_page(wrapper: &Box) {
let (input_height, monospace, input_alignment, input_wrapping): (i32, bool, Align, WrapMode) =
(24, true, Align::Fill, WrapMode::Word);
let inputs_first_line = Box::new(Orientation::Horizontal, 5);
inputs_first_line.set_valign(Align::Fill);
let input_height : i32 = 20;
let input_label_alignment = Alignment {
horizontal: Align::Start,
vertical: Align::Fill,
};
let wire_length_input = Input::builder()
.set_label("Длина провода (L = [м]):")
.set_align(Align::Fill)
.set_label("l, м:")
.set_margins(MarginData::EqualsMargin(5))
.build(true, WrapMode::Word, input_height)
.set_align(input_label_alignment)
.build(monospace, input_wrapping, input_height)
.get();
let resistance_input = Input::builder()
.set_label("Сопротивление (Rм = [Ом * м]):")
.set_align(Align::Fill)
wire_length_input.set_halign(input_alignment);
wire_length_input.set_hexpand(true);
let resistance_per_meter_input = Input::builder()
.set_label("Rм, Ом:")
.set_margins(MarginData::EqualsMargin(5))
.build(true, WrapMode::Word, input_height)
.set_align(input_label_alignment)
.build(monospace, input_wrapping, input_height)
.get();
let capacity_input = Input::builder()
.set_label("Ёмкость (Cм = [пФ * м]):")
.set_align(Align::Fill)
resistance_per_meter_input.set_halign(input_alignment);
resistance_per_meter_input.set_hexpand(true);
let capacity_per_meter_input = Input::builder()
.set_label("Cм, пФ:")
.set_margins(MarginData::EqualsMargin(5))
.build(true, WrapMode::Word, input_height)
.set_align(input_label_alignment)
.build(monospace, input_wrapping, input_height)
.get();
let inputs_second_line = Box::new(Orientation::Horizontal, 5);
capacity_per_meter_input.set_halign(input_alignment);
capacity_per_meter_input.set_hexpand(true);
inputs_second_line.set_valign(Align::Fill);
let wrapper_first_row = Wrapper::col_builder()
.halign(Align::Fill)
.hexpand(true)
.spacing(5)
.build();
let voltage_input = Input::builder()
.set_label("Напряжение (Vи = [мВ]):")
.set_align(Align::Fill)
wrapper_first_row.append(&wire_length_input);
wrapper_first_row.append(&resistance_per_meter_input);
wrapper_first_row.append(&capacity_per_meter_input);
let info_signal_voltage_input = Input::builder()
.set_label("Vи, мВ:")
.set_margins(MarginData::EqualsMargin(5))
.build(true, WrapMode::Word, input_height)
.set_align(input_label_alignment)
.build(monospace, input_wrapping, input_height)
.get();
let source_implicit_resistance_input = Input::builder()
.set_label("Сопротивление источника (R = [Ом]):")
.set_align(Align::Fill)
info_signal_voltage_input.set_halign(input_alignment);
info_signal_voltage_input.set_hexpand(true);
let resistance_of_info_voltage_source_input = Input::builder()
.set_label("Rи, Ом:")
.set_margins(MarginData::EqualsMargin(5))
.build(true, WrapMode::Word, input_height)
.set_align(input_label_alignment)
.build(monospace, input_wrapping, input_height)
.get();
let freq_input = Input::builder()
.set_label("Частота (f = [МГц]):")
.set_align(Align::Fill)
resistance_of_info_voltage_source_input.set_halign(input_alignment);
resistance_of_info_voltage_source_input.set_hexpand(true);
let info_voltage_source_frequency_input = Input::builder()
.set_label("f, мГц:")
.set_margins(MarginData::EqualsMargin(5))
.build(true, WrapMode::Word, input_height)
.set_align(input_label_alignment)
.build(monospace, input_wrapping, input_height)
.get();
info_voltage_source_frequency_input.set_halign(input_alignment);
info_voltage_source_frequency_input.set_hexpand(true);
inputs_first_line.append(&wire_length_input);
inputs_first_line.append(&resistance_input);
inputs_first_line.append(&capacity_input);
inputs_second_line.append(&voltage_input);
inputs_second_line.append(&source_implicit_resistance_input);
inputs_second_line.append(&freq_input);
let wrapper_second_row = Wrapper::col_builder()
.halign(Align::Fill)
.hexpand(true)
.spacing(5)
.build();
wrapper.append(&inputs_first_line);
wrapper.append(&inputs_second_line);
wrapper_second_row.append(&info_signal_voltage_input);
wrapper_second_row.append(&resistance_of_info_voltage_source_input);
wrapper_second_row.append(&info_voltage_source_frequency_input);
}
let main_wpapper = Wrapper::row_builder().spacing(5).build();
main_wpapper.append(&wrapper_first_row);
main_wpapper.append(&wrapper_second_row);
wrapper.append(&main_wpapper);
}

View File

@ -1,7 +1,7 @@
use gtk4 as gtk;
use gtk::{Align};
use gtk::builders::*;
use gtk::Align;
/**
* Types
@ -13,7 +13,7 @@ pub type Margin = (i32, i32, i32, i32);
* Enums
*/
pub enum MarginData{
pub enum MarginData {
EqualsMargin(i32),
MultipleMargin(Margin),
}
@ -26,40 +26,41 @@ pub enum MarginData{
pub struct Size {
pub width: i32,
pub height: i32
pub height: i32,
}
#[derive(Copy, Clone)]
pub struct Alignment {
pub horizontal: Align,
pub vertical : Align
pub vertical: Align,
}
/**
* Traits
*/
pub trait Setters{
pub trait Setters {
fn set_margin(self, margin: MarginData) -> Self;
fn set_align(self, align: Alignment) -> Self;
}
pub trait TextViewSetters{
pub trait TextViewSetters {
fn set_text_view_margin(self, margin: MarginData) -> Self;
}
impl TextViewSetters for TextViewBuilder{
fn set_text_view_margin(self, margin: MarginData) -> Self{
match margin{
MarginData::EqualsMargin(margin) =>
self.top_margin(margin)
.left_margin(margin)
.bottom_margin(margin)
.right_margin(margin),
MarginData::MultipleMargin(margins) =>
self.top_margin(margins.0)
.left_margin(margins.1)
.bottom_margin(margins.2)
.right_margin(margins.3),
impl TextViewSetters for TextViewBuilder {
fn set_text_view_margin(self, margin: MarginData) -> Self {
match margin {
MarginData::EqualsMargin(margin) => self
.top_margin(margin)
.left_margin(margin)
.bottom_margin(margin)
.right_margin(margin),
MarginData::MultipleMargin(margins) => self
.top_margin(margins.0)
.left_margin(margins.1)
.bottom_margin(margins.2)
.right_margin(margins.3),
}
}
}
@ -95,24 +96,25 @@ macro_rules! impl_setters {
}
}
impl_setters!{ButtonBuilder, EntryBuilder, TextViewBuilder,
impl_setters! {ButtonBuilder, EntryBuilder, TextViewBuilder,
BoxBuilder, SwitchBuilder, FrameBuilder, LabelBuilder}
#[allow(dead_code)]
impl Size{
pub fn new(w: i32, h: i32) -> Size{
Size{
impl Size {
pub fn new(w: i32, h: i32) -> Size {
Size {
width: w,
height: h,
}
}
}
impl Alignment{
pub fn new(horizontal: Align, vertical : Align) -> Alignment{
Alignment{
impl Alignment {
pub fn new(horizontal: Align, vertical: Align) -> Alignment {
Alignment {
horizontal,
vertical,
}
}
}
}

View File

@ -1,22 +1,18 @@
use crate::model::builder_traits::*;
use gtk4 as gtk;
use gtk::{*, prelude::*, StackTransitionType::SlideLeftRight};
use gtk::{prelude::*, StackTransitionType::SlideLeftRight, *};
use crate::{
view::{
properties::*,
components::{
*,
wrapper::*,
},
pages::*
},
};
use crate::view::components::pages::Pages;
pub fn ui(application: &adw::Application) {
#[allow(unused)]
use crate::view::{
components::{wrapper::*, *},
pages::*,
properties::*,
};
pub fn ui(application: &adw::Application) {
let hamming_code = Wrapper::row_builder()
.set_align(Alignment::new(Align::Fill, Align::Fill))
.set_margin(MarginData::EqualsMargin(15))
@ -37,7 +33,7 @@ pub fn ui(application: &adw::Application) {
.set_transition(SlideLeftRight, 200)
.append_items(vec![
("Код Хэмминга", "Код Хэмминга", &hamming_code),
("Затухание сигнала", "Затухание сигнала", &signal_reducing)
("Затухание сигнала", "Затухание сигнала", &signal_reducing),
])
.build(5)
.get();
@ -51,4 +47,4 @@ pub fn ui(application: &adw::Application) {
.build();
window.show();
}
}