mirror of
https://github.com/TxtDot/dalet-rs.git
synced 2024-11-06 01:43:57 +03:00
fix: daletpack optimizing
This commit is contained in:
parent
dd597d278c
commit
573929beee
9 changed files with 166 additions and 375 deletions
289
Cargo.lock
generated
289
Cargo.lock
generated
|
@ -3,10 +3,10 @@
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "adler"
|
name = "adler2"
|
||||||
version = "1.0.2"
|
version = "2.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ahash"
|
name = "ahash"
|
||||||
|
@ -71,7 +71,7 @@ version = "1.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
|
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -81,7 +81,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
|
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"windows-sys",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -96,20 +96,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.3.0"
|
version = "1.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
|
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bigdecimal"
|
|
||||||
version = "0.3.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa"
|
|
||||||
dependencies = [
|
|
||||||
"num-bigint",
|
|
||||||
"num-integer",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bincode"
|
name = "bincode"
|
||||||
|
@ -128,12 +117,13 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.1.7"
|
version = "1.1.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc"
|
checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"jobserver",
|
"jobserver",
|
||||||
"libc",
|
"libc",
|
||||||
|
"shlex",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -148,7 +138,7 @@ version = "1.0.0-alpha.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c7b80276986f86789dc56ca6542d53bba9cda3c66091ebbe7bd96fc1bdf20f1f"
|
checksum = "c7b80276986f86789dc56ca6542d53bba9cda3c66091ebbe7bd96fc1bdf20f1f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hashbrown",
|
"hashbrown 0.14.5",
|
||||||
"regex-automata",
|
"regex-automata",
|
||||||
"serde",
|
"serde",
|
||||||
"stacker",
|
"stacker",
|
||||||
|
@ -157,9 +147,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.13"
|
version = "4.5.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc"
|
checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
|
@ -167,9 +157,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.5.13"
|
version = "4.5.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99"
|
checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
|
@ -179,14 +169,14 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_derive"
|
name = "clap_derive"
|
||||||
version = "4.5.13"
|
version = "4.5.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0"
|
checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.72",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -218,7 +208,6 @@ dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"chumsky",
|
"chumsky",
|
||||||
"clap",
|
"clap",
|
||||||
"dlhn",
|
|
||||||
"enum-procs",
|
"enum-procs",
|
||||||
"flate2",
|
"flate2",
|
||||||
"num_enum",
|
"num_enum",
|
||||||
|
@ -228,41 +217,6 @@ dependencies = [
|
||||||
"zstd",
|
"zstd",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "deranged"
|
|
||||||
version = "0.3.11"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
|
|
||||||
dependencies = [
|
|
||||||
"powerfmt",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dlhn"
|
|
||||||
version = "0.1.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "56f8c0fbf92cd49450565bc2231273fabc48bbbf0d152b5b32ee4ce13eed469e"
|
|
||||||
dependencies = [
|
|
||||||
"bigdecimal",
|
|
||||||
"dlhn_derive",
|
|
||||||
"num-bigint",
|
|
||||||
"num-traits",
|
|
||||||
"serde",
|
|
||||||
"serde_bytes",
|
|
||||||
"time",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dlhn_derive"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e579511d5845df93b92409782ce0e5cdbc10dd239f5aa4c9e53f229d6ac620c0"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 1.0.109",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "enum-procs"
|
name = "enum-procs"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
@ -270,7 +224,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e188616f4527e2cf6128e58622bb2fd16ebcfa37a200b2d16739c3ca227bf649"
|
checksum = "e188616f4527e2cf6128e58622bb2fd16ebcfa37a200b2d16739c3ca227bf649"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.72",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -281,9 +235,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flate2"
|
name = "flate2"
|
||||||
version = "1.0.30"
|
version = "1.0.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae"
|
checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
|
@ -299,6 +253,12 @@ dependencies = [
|
||||||
"allocator-api2",
|
"allocator-api2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.15.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
|
@ -307,12 +267,12 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.2.6"
|
version = "2.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
|
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown",
|
"hashbrown 0.15.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -332,9 +292,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.155"
|
version = "0.2.159"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
|
@ -344,36 +304,11 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
version = "0.7.4"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
|
checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"adler",
|
"adler2",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-bigint"
|
|
||||||
version = "0.4.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
|
|
||||||
dependencies = [
|
|
||||||
"num-integer",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-conv"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-integer"
|
|
||||||
version = "0.1.46"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
|
|
||||||
dependencies = [
|
|
||||||
"num-traits",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -403,14 +338,14 @@ dependencies = [
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.72",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.19.0"
|
version = "1.20.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "paste"
|
name = "paste"
|
||||||
|
@ -420,21 +355,15 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pkg-config"
|
name = "pkg-config"
|
||||||
version = "0.3.30"
|
version = "0.3.31"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
|
checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "powerfmt"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro-crate"
|
name = "proc-macro-crate"
|
||||||
version = "3.1.0"
|
version = "3.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284"
|
checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"toml_edit",
|
"toml_edit",
|
||||||
]
|
]
|
||||||
|
@ -450,18 +379,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "psm"
|
name = "psm"
|
||||||
version = "0.1.21"
|
version = "0.1.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874"
|
checksum = "aa37f80ca58604976033fae9515a8a2989fc13797d953f7c04fb8fa36a11f205"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.36"
|
version = "1.0.37"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
@ -507,31 +436,22 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.204"
|
version = "1.0.210"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
|
checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_bytes"
|
|
||||||
version = "0.11.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.204"
|
version = "1.0.210"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
|
checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.72",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -542,20 +462,26 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.72",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stacker"
|
name = "shlex"
|
||||||
version = "0.1.15"
|
version = "1.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce"
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "stacker"
|
||||||
|
version = "0.1.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "799c883d55abdb5e98af1a7b3f23b9b6de8ecada0ecac058672d7635eb48ca7b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
"psm",
|
"psm",
|
||||||
"winapi",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -566,45 +492,15 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.109"
|
version = "2.0.79"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "syn"
|
|
||||||
version = "2.0.72"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"unicode-ident",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time"
|
|
||||||
version = "0.3.36"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
|
|
||||||
dependencies = [
|
|
||||||
"deranged",
|
|
||||||
"num-conv",
|
|
||||||
"powerfmt",
|
|
||||||
"serde",
|
|
||||||
"time-core",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time-core"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_datetime"
|
name = "toml_datetime"
|
||||||
version = "0.6.8"
|
version = "0.6.8"
|
||||||
|
@ -613,9 +509,9 @@ checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_edit"
|
||||||
version = "0.21.1"
|
version = "0.22.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
|
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
|
@ -624,15 +520,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.12"
|
version = "1.0.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-width"
|
name = "unicode-width"
|
||||||
version = "0.1.13"
|
version = "0.1.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d"
|
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "utf8parse"
|
name = "utf8parse"
|
||||||
|
@ -646,28 +542,6 @@ version = "0.9.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi"
|
|
||||||
version = "0.3.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
|
||||||
dependencies = [
|
|
||||||
"winapi-i686-pc-windows-gnu",
|
|
||||||
"winapi-x86_64-pc-windows-gnu",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi-i686-pc-windows-gnu"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi-x86_64-pc-windows-gnu"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.52.0"
|
version = "0.52.0"
|
||||||
|
@ -677,6 +551,15 @@ dependencies = [
|
||||||
"windows-targets",
|
"windows-targets",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.59.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-targets"
|
name = "windows-targets"
|
||||||
version = "0.52.6"
|
version = "0.52.6"
|
||||||
|
@ -743,9 +626,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "0.5.40"
|
version = "0.6.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
|
checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
@ -773,7 +656,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.72",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -787,18 +670,18 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zstd-safe"
|
name = "zstd-safe"
|
||||||
version = "7.2.0"
|
version = "7.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fa556e971e7b568dc775c136fc9de8c779b1c2fc3a63defaafadffdbd3181afa"
|
checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"zstd-sys",
|
"zstd-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zstd-sys"
|
name = "zstd-sys"
|
||||||
version = "2.0.12+zstd.1.5.6"
|
version = "2.0.13+zstd.1.5.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0a4e40c320c3cb459d9a9ff6de98cff88f4751ee9275d140e2be94a2b74e4c13"
|
checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
|
|
|
@ -30,7 +30,6 @@ ariadne = { version = "0.4.1", optional = true }
|
||||||
rmp-serde = "1.3.0"
|
rmp-serde = "1.3.0"
|
||||||
bincode = "1.3.3"
|
bincode = "1.3.3"
|
||||||
flate2 = "1.0"
|
flate2 = "1.0"
|
||||||
dlhn = "0.1"
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["types", "daletpack", "parsers", "daleth"]
|
default = ["types", "daletpack", "parsers", "daleth"]
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
use dalet::{
|
use dalet::{
|
||||||
daletl::DlPage,
|
|
||||||
daletpack::*,
|
daletpack::*,
|
||||||
typed::{Hl, TNullArg, Tag::*},
|
typed::{Hl, TNullArg, Tag::*},
|
||||||
};
|
};
|
||||||
use flate2::Compression;
|
use flate2::Compression;
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
@ -51,21 +49,6 @@ fn compress_zlib(data: &[u8]) -> std::io::Result<Vec<u8>> {
|
||||||
c.finish()
|
c.finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dlhn_serialize(page: &DlPage) -> Vec<u8> {
|
|
||||||
let mut output = Vec::new();
|
|
||||||
let mut serializer = dlhn::Serializer::new(&mut output);
|
|
||||||
page.serialize(&mut serializer).unwrap();
|
|
||||||
|
|
||||||
output
|
|
||||||
}
|
|
||||||
|
|
||||||
fn dlhn_deserialize(output: &Vec<u8>) -> DlPage {
|
|
||||||
let mut reader = output.as_slice();
|
|
||||||
let mut deserializer = dlhn::Deserializer::new(&mut reader);
|
|
||||||
|
|
||||||
DlPage::deserialize(&mut deserializer).unwrap()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let page = vec![
|
let page = vec![
|
||||||
H("Heading 1".into(), Hl::One),
|
H("Heading 1".into(), Hl::One),
|
||||||
|
@ -117,7 +100,6 @@ fn main() {
|
||||||
|
|
||||||
bench!("Markdown", include_str!("./bench.md").as_bytes().to_vec());
|
bench!("Markdown", include_str!("./bench.md").as_bytes().to_vec());
|
||||||
bench!("Daletpack", encode_no_compress(&dalet_page).unwrap());
|
bench!("Daletpack", encode_no_compress(&dalet_page).unwrap());
|
||||||
bench!("Dlhn", dlhn_serialize(&dalet_page));
|
|
||||||
bench!("Messagepack", rmp_serde::to_vec(&dalet_page).unwrap());
|
bench!("Messagepack", rmp_serde::to_vec(&dalet_page).unwrap());
|
||||||
bench!("Bincode", bincode::serialize(&dalet_page).unwrap());
|
bench!("Bincode", bincode::serialize(&dalet_page).unwrap());
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,18 +12,18 @@ pub struct DlPage {
|
||||||
pub struct DlTag {
|
pub struct DlTag {
|
||||||
pub id: DlTid,
|
pub id: DlTid,
|
||||||
pub body: DlBody,
|
pub body: DlBody,
|
||||||
pub argument: DlArgument,
|
pub argument: DlArg,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DlTag {
|
impl DlTag {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(id: DlTid, body: DlBody, argument: DlArgument) -> DlTag {
|
pub fn new(id: DlTid, body: DlBody, argument: DlArg) -> DlTag {
|
||||||
DlTag { id, body, argument }
|
DlTag { id, body, argument }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn dlt_new(id: DlTid, body: DlBody, argument: DlArgument) -> DlTag {
|
pub fn dlt_new(id: DlTid, body: DlBody, argument: DlArg) -> DlTag {
|
||||||
DlTag::new(id, body, argument)
|
DlTag::new(id, body, argument)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ pub enum DlBody {
|
||||||
|
|
||||||
#[derive(AutoFrom, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
#[derive(AutoFrom, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum DlArgument {
|
pub enum DlArg {
|
||||||
Text(String),
|
Text(String),
|
||||||
Number(u8),
|
Number(u8),
|
||||||
Null,
|
Null,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::daletl::{DlArgument, DlBody, DlPage, DlTag, DlTid};
|
use crate::daletl::{DlArg, DlBody, DlPage, DlTag};
|
||||||
|
|
||||||
use super::{utils, DaletPackError, TypeId};
|
use super::{utils, DaletPackError, TypeId};
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ fn write_str(bv: &mut Vec<u8>, string: &String) -> Result<(), DaletPackError> {
|
||||||
}
|
}
|
||||||
|
|
||||||
bv.extend_from_slice(string.as_bytes());
|
bv.extend_from_slice(string.as_bytes());
|
||||||
bv.push(TypeId::TextEnd as u8);
|
bv.push(TypeId::EndOfBody as u8);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -43,106 +43,46 @@ fn write_array(bv: &mut Vec<u8>, arr: &Vec<DlTag>) -> Result<(), DaletPackError>
|
||||||
}
|
}
|
||||||
|
|
||||||
if arr.len() != 1 {
|
if arr.len() != 1 {
|
||||||
bv.push(TypeId::TagsEnd as u8);
|
bv.push(TypeId::EndOfBody as u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_tag(bv: &mut Vec<u8>, tag: &DlTag) -> Result<(), DaletPackError> {
|
fn write_tag(bv: &mut Vec<u8>, tag: &DlTag) -> Result<(), DaletPackError> {
|
||||||
// TypeId and TagId if needed
|
let type_id = match (&tag.body, &tag.argument) {
|
||||||
match (&tag.body, &tag.argument) {
|
(DlBody::Text(_), DlArg::Text(_)) => TypeId::TextText,
|
||||||
(DlBody::Text(_), DlArgument::Text(_)) => match &tag.id {
|
(DlBody::Text(_), DlArg::Number(_)) => TypeId::TextNumber,
|
||||||
DlTid::Meta => bv.push(TypeId::Meta as u8),
|
(DlBody::Text(_), DlArg::Null) => TypeId::TextBody,
|
||||||
_ => {
|
(DlBody::Tags(vec), DlArg::Text(_)) => {
|
||||||
bv.push(TypeId::CompTextText as u8);
|
if vec.len() == 1 {
|
||||||
bv.push(tag.id as u8);
|
TypeId::TagText
|
||||||
}
|
|
||||||
},
|
|
||||||
(DlBody::Text(_), DlArgument::Number(_)) => {
|
|
||||||
bv.push(TypeId::CompTextNumber as u8);
|
|
||||||
bv.push(tag.id as u8);
|
|
||||||
}
|
|
||||||
(DlBody::Text(_), DlArgument::Null) => match &tag.id {
|
|
||||||
DlTid::El => bv.push(TypeId::ElText as u8),
|
|
||||||
DlTid::P => bv.push(TypeId::PText as u8),
|
|
||||||
DlTid::B => bv.push(TypeId::B as u8),
|
|
||||||
DlTid::I => bv.push(TypeId::I as u8),
|
|
||||||
DlTid::S => bv.push(TypeId::S as u8),
|
|
||||||
DlTid::Sup => bv.push(TypeId::Sup as u8),
|
|
||||||
DlTid::Sub => bv.push(TypeId::Sub as u8),
|
|
||||||
|
|
||||||
_ => {
|
|
||||||
bv.push(TypeId::BodyText as u8);
|
|
||||||
bv.push(tag.id as u8);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
(DlBody::Tags(tags), DlArgument::Text(_)) => {
|
|
||||||
if tags.len() == 1 {
|
|
||||||
bv.push(TypeId::CompTagText as u8);
|
|
||||||
} else {
|
} else {
|
||||||
bv.push(TypeId::CompTagsText as u8);
|
TypeId::TagsText
|
||||||
}
|
}
|
||||||
|
|
||||||
bv.push(tag.id as u8);
|
|
||||||
}
|
}
|
||||||
(DlBody::Tags(tags), DlArgument::Number(_)) => {
|
(DlBody::Tags(vec), DlArg::Number(_)) => {
|
||||||
if tags.len() == 1 {
|
if vec.len() == 1 {
|
||||||
bv.push(TypeId::CompTagNumber as u8);
|
TypeId::TagNumber
|
||||||
} else {
|
} else {
|
||||||
bv.push(TypeId::CompTagsNumber as u8);
|
TypeId::TagsNumber
|
||||||
}
|
|
||||||
|
|
||||||
bv.push(tag.id as u8);
|
|
||||||
}
|
|
||||||
(DlBody::Tags(tags), DlArgument::Null) => {
|
|
||||||
if tags.len() == 1 {
|
|
||||||
match &tag.id {
|
|
||||||
DlTid::El => bv.push(TypeId::ElTag as u8),
|
|
||||||
DlTid::P => bv.push(TypeId::PTag as u8),
|
|
||||||
_ => {
|
|
||||||
bv.push(TypeId::BodyTag as u8);
|
|
||||||
bv.push(tag.id as u8);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
(DlBody::Tags(vec), DlArg::Null) => {
|
||||||
|
if vec.len() == 1 {
|
||||||
|
TypeId::TagBody
|
||||||
} else {
|
} else {
|
||||||
match &tag.id {
|
TypeId::TagsBody
|
||||||
DlTid::El => bv.push(TypeId::ElTags as u8),
|
|
||||||
DlTid::P => bv.push(TypeId::PTags as u8),
|
|
||||||
_ => {
|
|
||||||
bv.push(TypeId::BodyTags as u8);
|
|
||||||
bv.push(tag.id as u8);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
(DlBody::Null, DlArg::Text(_)) => TypeId::TextArg,
|
||||||
}
|
(DlBody::Null, DlArg::Number(_)) => TypeId::NumberArg,
|
||||||
(DlBody::Null, DlArgument::Text(_)) => match &tag.id {
|
(DlBody::Null, DlArg::Null) => TypeId::JustId,
|
||||||
DlTid::Img => bv.push(TypeId::Img as u8),
|
|
||||||
DlTid::A => bv.push(TypeId::AText as u8),
|
|
||||||
|
|
||||||
_ => {
|
|
||||||
bv.push(TypeId::ArgText as u8);
|
|
||||||
bv.push(tag.id as u8);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
(DlBody::Null, DlArgument::Number(_)) => match &tag.id {
|
|
||||||
DlTid::A => bv.push(TypeId::ANumber as u8),
|
|
||||||
_ => {
|
|
||||||
bv.push(TypeId::ArgNumber as u8);
|
|
||||||
bv.push(tag.id as u8);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
(DlBody::Null, DlArgument::Null) => match &tag.id {
|
|
||||||
DlTid::Br => bv.push(TypeId::Br as u8),
|
|
||||||
DlTid::Hr => bv.push(TypeId::Hr as u8),
|
|
||||||
|
|
||||||
_ => {
|
|
||||||
bv.push(TypeId::Id as u8);
|
|
||||||
bv.push(tag.id as u8);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bv.push(type_id as u8);
|
||||||
|
bv.push(tag.id as u8);
|
||||||
|
|
||||||
write_tag_body(bv, &tag.body)?;
|
write_tag_body(bv, &tag.body)?;
|
||||||
write_tag_argument(bv, &tag.argument)?;
|
write_tag_argument(bv, &tag.argument)?;
|
||||||
|
|
||||||
|
@ -159,11 +99,11 @@ fn write_tag_body(bv: &mut Vec<u8>, body: &DlBody) -> Result<(), DaletPackError>
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_tag_argument(bv: &mut Vec<u8>, argument: &DlArgument) -> Result<(), DaletPackError> {
|
fn write_tag_argument(bv: &mut Vec<u8>, argument: &DlArg) -> Result<(), DaletPackError> {
|
||||||
match argument {
|
match argument {
|
||||||
DlArgument::Text(s) => write_str(bv, s)?,
|
DlArg::Text(s) => write_str(bv, s)?,
|
||||||
DlArgument::Number(n) => bv.push(*n),
|
DlArg::Number(n) => bv.push(*n),
|
||||||
DlArgument::Null => {}
|
DlArg::Null => {}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -43,35 +43,22 @@ impl From<TryFromPrimitiveError<DlTid>> for DaletPackDecodeError {
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, TryFromPrimitive, Copy)]
|
#[derive(Debug, Clone, PartialEq, Eq, TryFromPrimitive, Copy)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum TypeId {
|
pub enum TypeId {
|
||||||
TextEnd = 0x00,
|
EndOfBody,
|
||||||
TagsEnd,
|
|
||||||
BodyText = 0xa0,
|
TextBody,
|
||||||
BodyTag,
|
TagBody,
|
||||||
BodyTags,
|
TagsBody,
|
||||||
ArgText = 0xb0,
|
|
||||||
ArgNumber,
|
TextArg,
|
||||||
CompTextText = 0xc0,
|
NumberArg,
|
||||||
CompTagText,
|
|
||||||
CompTagsText,
|
TextText,
|
||||||
CompTextNumber,
|
TagText,
|
||||||
CompTagNumber,
|
TagsText,
|
||||||
CompTagsNumber,
|
|
||||||
Id = 0xd0,
|
TextNumber,
|
||||||
ElText,
|
TagNumber,
|
||||||
ElTag,
|
TagsNumber,
|
||||||
ElTags,
|
|
||||||
PText,
|
JustId,
|
||||||
PTag,
|
|
||||||
PTags,
|
|
||||||
Br,
|
|
||||||
Hr,
|
|
||||||
Img,
|
|
||||||
B,
|
|
||||||
I,
|
|
||||||
ANumber,
|
|
||||||
AText,
|
|
||||||
S,
|
|
||||||
Sup,
|
|
||||||
Sub,
|
|
||||||
Meta,
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,35 +48,35 @@ impl TryFrom<DlTag> for Tag {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<DlArgument> for Hl {
|
impl TryFrom<DlArg> for Hl {
|
||||||
type Error = ConversionError;
|
type Error = ConversionError;
|
||||||
|
|
||||||
fn try_from(value: DlArgument) -> Result<Self, Self::Error> {
|
fn try_from(value: DlArg) -> Result<Self, Self::Error> {
|
||||||
match value {
|
match value {
|
||||||
DlArgument::Number(n) => n.try_into().map_err(|_| ConversionError),
|
DlArg::Number(n) => n.try_into().map_err(|_| ConversionError),
|
||||||
_ => Err(ConversionError),
|
_ => Err(ConversionError),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<DlArgument> for AlignArg {
|
impl TryFrom<DlArg> for AlignArg {
|
||||||
type Error = ConversionError;
|
type Error = ConversionError;
|
||||||
|
|
||||||
fn try_from(value: DlArgument) -> Result<Self, Self::Error> {
|
fn try_from(value: DlArg) -> Result<Self, Self::Error> {
|
||||||
match value {
|
match value {
|
||||||
DlArgument::Number(n) => n.try_into().map_err(|_| ConversionError),
|
DlArg::Number(n) => n.try_into().map_err(|_| ConversionError),
|
||||||
_ => Err(ConversionError),
|
_ => Err(ConversionError),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<DlArgument> for TNullArg {
|
impl TryFrom<DlArg> for TNullArg {
|
||||||
type Error = ConversionError;
|
type Error = ConversionError;
|
||||||
|
|
||||||
fn try_from(value: DlArgument) -> Result<Self, Self::Error> {
|
fn try_from(value: DlArg) -> Result<Self, Self::Error> {
|
||||||
match value {
|
match value {
|
||||||
DlArgument::Text(t) => Ok(TNullArg::Text(t)),
|
DlArg::Text(t) => Ok(TNullArg::Text(t)),
|
||||||
DlArgument::Null => Ok(TNullArg::Null),
|
DlArg::Null => Ok(TNullArg::Null),
|
||||||
_ => Err(ConversionError),
|
_ => Err(ConversionError),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,24 +109,24 @@ impl TryFrom<DlBody> for String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<DlArgument> for NNArg {
|
impl TryFrom<DlArg> for NNArg {
|
||||||
type Error = ConversionError;
|
type Error = ConversionError;
|
||||||
|
|
||||||
fn try_from(value: DlArgument) -> Result<Self, Self::Error> {
|
fn try_from(value: DlArg) -> Result<Self, Self::Error> {
|
||||||
match value {
|
match value {
|
||||||
DlArgument::Text(t) => Ok(t.into()),
|
DlArg::Text(t) => Ok(t.into()),
|
||||||
DlArgument::Number(n) => Ok(n.into()),
|
DlArg::Number(n) => Ok(n.into()),
|
||||||
DlArgument::Null => Err(ConversionError),
|
DlArg::Null => Err(ConversionError),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<DlArgument> for String {
|
impl TryFrom<DlArg> for String {
|
||||||
type Error = ConversionError;
|
type Error = ConversionError;
|
||||||
|
|
||||||
fn try_from(value: DlArgument) -> Result<Self, Self::Error> {
|
fn try_from(value: DlArg) -> Result<Self, Self::Error> {
|
||||||
match value {
|
match value {
|
||||||
DlArgument::Text(s) => Ok(s),
|
DlArg::Text(s) => Ok(s),
|
||||||
_ => Err(ConversionError),
|
_ => Err(ConversionError),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::daletl::{DlArgument, DlBody, IsNull};
|
use crate::daletl::{DlArg, DlBody, IsNull};
|
||||||
|
|
||||||
impl IsNull for DlBody {
|
impl IsNull for DlBody {
|
||||||
fn is_null(&self) -> bool {
|
fn is_null(&self) -> bool {
|
||||||
|
@ -6,7 +6,7 @@ impl IsNull for DlBody {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IsNull for DlArgument {
|
impl IsNull for DlArg {
|
||||||
fn is_null(&self) -> bool {
|
fn is_null(&self) -> bool {
|
||||||
matches!(self, Self::Null)
|
matches!(self, Self::Null)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::{daletl::*, typed::*};
|
use crate::{daletl::*, typed::*};
|
||||||
|
|
||||||
const NB: DlBody = DlBody::Null;
|
const NB: DlBody = DlBody::Null;
|
||||||
const NA: DlArgument = DlArgument::Null;
|
const NA: DlArg = DlArg::Null;
|
||||||
|
|
||||||
impl From<Tag> for DlTag {
|
impl From<Tag> for DlTag {
|
||||||
fn from(item: Tag) -> DlTag {
|
fn from(item: Tag) -> DlTag {
|
||||||
|
@ -41,8 +41,8 @@ impl From<Tag> for DlTag {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Hl> for DlArgument {
|
impl From<Hl> for DlArg {
|
||||||
fn from(item: Hl) -> DlArgument {
|
fn from(item: Hl) -> DlArg {
|
||||||
match item {
|
match item {
|
||||||
Hl::One => NA,
|
Hl::One => NA,
|
||||||
Hl::Two => 2u8.into(),
|
Hl::Two => 2u8.into(),
|
||||||
|
@ -54,8 +54,8 @@ impl From<Hl> for DlArgument {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<AlignArg> for DlArgument {
|
impl From<AlignArg> for DlArg {
|
||||||
fn from(item: AlignArg) -> DlArgument {
|
fn from(item: AlignArg) -> DlArg {
|
||||||
match item {
|
match item {
|
||||||
AlignArg::Start => NA,
|
AlignArg::Start => NA,
|
||||||
AlignArg::Center => 1u8.into(),
|
AlignArg::Center => 1u8.into(),
|
||||||
|
@ -64,8 +64,8 @@ impl From<AlignArg> for DlArgument {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<TNullArg> for DlArgument {
|
impl From<TNullArg> for DlArg {
|
||||||
fn from(item: TNullArg) -> DlArgument {
|
fn from(item: TNullArg) -> DlArg {
|
||||||
match item {
|
match item {
|
||||||
TNullArg::Text(s) => s.into(),
|
TNullArg::Text(s) => s.into(),
|
||||||
TNullArg::Null => NA,
|
TNullArg::Null => NA,
|
||||||
|
@ -83,8 +83,8 @@ impl From<Body> for DlBody {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<NNArg> for DlArgument {
|
impl From<NNArg> for DlArg {
|
||||||
fn from(item: NNArg) -> DlArgument {
|
fn from(item: NNArg) -> DlArg {
|
||||||
match item {
|
match item {
|
||||||
NNArg::Number(v) => v.into(),
|
NNArg::Number(v) => v.into(),
|
||||||
NNArg::Text(v) => v.into(),
|
NNArg::Text(v) => v.into(),
|
||||||
|
|
Loading…
Reference in a new issue