diff options
| author | Max Audron <audron@cocaine.farm> | 2025-02-22 20:10:45 +0100 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2025-02-22 20:10:45 +0100 |
| commit | 6bd871a9af959ab7ca39d6250954e0f1f452b8f9 (patch) | |
| tree | 675d252137df85da0fdff7b304075a645e4da43a | |
| parent | update flake (diff) | |
update dependencies and fix errors
Diffstat (limited to '')
| -rw-r--r-- | Cargo.lock | 639 | ||||
| -rw-r--r-- | Cargo.toml | 22 | ||||
| -rw-r--r-- | rustfmt.toml | 1 | ||||
| -rw-r--r-- | src/lib.rs | 1 | ||||
| -rw-r--r-- | src/message/signalproxy/objects/coreinfo.rs | 6 | ||||
| -rw-r--r-- | src/message/signalproxy/objects/ircuser.rs | 22 | ||||
| -rw-r--r-- | src/primitive/datetime.rs | 40 | ||||
| -rw-r--r-- | src/primitive/message.rs | 1 | ||||
| -rw-r--r-- | src/primitive/variant.rs | 108 |
9 files changed, 332 insertions, 508 deletions
@@ -1,118 +1,82 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" -version = "0.17.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -dependencies = [ - "winapi", -] +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "async-stream" -version = "0.3.2" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" dependencies = [ "async-stream-impl", "futures-core", + "pin-project-lite", ] [[package]] name = "async-stream-impl" -version = "0.3.2" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.98", ] [[package]] name = "autocfg" -version = "1.0.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.63" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "321629d8ba6513061f26707241fa9bc89524ff1cd7a915a97ef0c62c666ce1b6" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets", ] [[package]] -name = "base-x" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" - -[[package]] name = "bitflags" -version = "1.3.2" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bumpalo" -version = "3.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c" +checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" [[package]] name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "0.4.12" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" - -[[package]] -name = "cc" -version = "1.0.72" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" +checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9" [[package]] name = "cfg-if" @@ -121,49 +85,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "const_fn" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" - -[[package]] name = "crc32fast" -version = "1.3.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.1" +version = "0.5.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" -dependencies = [ - "cfg-if", - "lazy_static", -] - -[[package]] -name = "ctor" -version = "0.1.21" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa" -dependencies = [ - "quote", - "syn", -] +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "darling" @@ -186,7 +129,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 1.0.109", ] [[package]] @@ -197,26 +140,29 @@ checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a" dependencies = [ "darling_core", "quote", - "syn", + "syn 1.0.109", ] [[package]] -name = "difference" -version = "2.0.0" +name = "deranged" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] [[package]] -name = "discard" -version = "1.0.4" +name = "diff" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" [[package]] name = "either" -version = "1.6.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "failure" @@ -236,22 +182,18 @@ checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "synstructure", ] [[package]] name = "flate2" -version = "1.0.22" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ - "cfg-if", "crc32fast", - "futures 0.1.31", - "libc", "miniz_oxide", - "tokio-io", ] [[package]] @@ -262,15 +204,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "futures" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" - -[[package]] -name = "futures" -version = "0.3.18" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd0210d8c325c245ff06fd95a3b13689a1a276ac8cfa8e8720cb840bfb84b9e" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -283,9 +219,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.18" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc8cd39e3dbf865f7340dce6a2d401d24fd37c6fe6c4f0ee0de8bfca2252d27" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -293,15 +229,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.18" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629316e42fe7c2a0b9a65b47d159ceaa5453ab14e8f0a3c5eedbb8cd55b4a445" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.18" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b808bf53348a36cab739d7e04755909b9fcaaa69b7d7e588b37b6ec62704c97" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -310,38 +246,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.18" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e481354db6b5c353246ccf6a728b0c5511d752c08da7260546fc0933869daa11" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.18" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a89f17b21645bc4ed773c69af9c9a0effd4a3f1a3876eadd453469f8854e7fdd" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.98", ] [[package]] name = "futures-sink" -version = "0.3.18" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "996c6442437b62d21a32cd9906f9c41e7dc1e19a9579843fad948696769305af" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.18" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dabf1872aaab32c886832f2276d2f5399887e2bd613698a02359e4ea83f8de12" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.18" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d22213122356472061ac0f1ab2cee28d2bac8491410fd68c2af53d1cedb83e" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -357,9 +293,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.1" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "ident_case" @@ -368,40 +304,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - -[[package]] name = "itertools" -version = "0.10.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" dependencies = [ "either", ] [[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] name = "libc" -version = "0.2.108" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libquassel" @@ -409,11 +324,11 @@ version = "0.1.0" dependencies = [ "bitflags", "byteorder", - "bytes 1.1.0", + "bytes", "crossbeam-channel", "failure", "flate2", - "futures 0.3.18", + "futures", "itertools", "libquassel-derive", "log", @@ -434,83 +349,85 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "log" -version = "0.4.14" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -dependencies = [ - "cfg-if", -] +checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" [[package]] name = "memchr" -version = "2.4.1" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "miniz_oxide" -version = "0.4.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" dependencies = [ - "adler", - "autocfg", + "adler2", ] [[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] name = "num-derive" -version = "0.3.3" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.98", ] [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] -name = "object" -version = "0.27.1" +name = "num_threads" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" dependencies = [ - "memchr", + "libc", ] [[package]] -name = "once_cell" -version = "1.8.0" +name = "object" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] [[package]] -name = "output_vt100" -version = "0.1.2" +name = "once_cell" +version = "1.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9" -dependencies = [ - "winapi", -] +checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" [[package]] name = "pin-project-lite" -version = "0.2.7" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -519,190 +436,100 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "pretty_assertions" -version = "0.6.1" +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427" -dependencies = [ - "ansi_term", - "ctor", - "difference", - "output_vt100", -] +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] -name = "proc-macro-hack" -version = "0.5.19" +name = "pretty_assertions" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" +dependencies = [ + "diff", + "yansi", +] [[package]] name = "proc-macro2" -version = "1.0.32" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.10" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] [[package]] name = "rustc-demangle" -version = "0.1.21" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - -[[package]] -name = "ryu" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c9613b5a66ab9ba26415184cfc41156594925a9cf3a2057e57f31ff145f6568" - -[[package]] -name = "semver" -version = "0.9.0" +name = "serde" +version = "1.0.218" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60" dependencies = [ - "semver-parser", + "serde_derive", ] [[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "serde" -version = "1.0.130" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" - -[[package]] name = "serde_derive" -version = "1.0.130" +version = "1.0.218" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" +checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.98", ] [[package]] -name = "serde_json" -version = "1.0.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ffa0837f2dfa6fb90868c2b5468cad482e175f7dad97e7421951e663f2b527" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - -[[package]] name = "slab" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" - -[[package]] -name = "standback" -version = "0.2.17" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ - "version_check", -] - -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", + "autocfg", ] [[package]] -name = "stdweb-derive" -version = "0.5.3" +name = "strsim" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn", -] +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] -name = "stdweb-internal-macros" -version = "0.2.9" +name = "syn" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "base-x", "proc-macro2", "quote", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn", + "unicode-ident", ] [[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] name = "syn" -version = "1.0.82" +version = "2.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59" +checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] @@ -713,74 +540,57 @@ checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "unicode-xid", ] [[package]] name = "time" -version = "0.2.27" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ - "const_fn", + "deranged", "libc", - "standback", - "stdweb", + "num-conv", + "num_threads", + "powerfmt", + "serde", + "time-core", "time-macros", - "version_check", - "winapi", ] [[package]] -name = "time-macros" -version = "0.1.1" +name = "time-core" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] -name = "time-macros-impl" -version = "0.1.2" +name = "time-macros" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "standback", - "syn", + "num-conv", + "time-core", ] [[package]] name = "tokio" -version = "1.14.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144" +checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" dependencies = [ - "autocfg", + "backtrace", "pin-project-lite", ] [[package]] -name = "tokio-io" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" -dependencies = [ - "bytes 0.4.12", - "futures 0.1.31", - "log", -] - -[[package]] name = "tokio-stream" -version = "0.1.8" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -789,12 +599,12 @@ dependencies = [ [[package]] name = "tokio-test" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53474327ae5e166530d17f2d956afcb4f8a004de581b3cae10f12006bc8163e3" +checksum = "2468baabc3311435b55dd935f702f42cd1b8abb7e754fb7dfb16bd36aa88f9f7" dependencies = [ "async-stream", - "bytes 1.1.0", + "bytes", "futures-core", "tokio", "tokio-stream", @@ -802,102 +612,95 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.6.9" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ - "bytes 1.1.0", + "bytes", "futures-core", "futures-sink", - "log", "pin-project-lite", "tokio", ] [[package]] -name = "unicode-xid" -version = "0.2.2" +name = "unicode-ident" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe" [[package]] -name = "version_check" -version = "0.9.3" +name = "unicode-xid" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] -name = "wasm-bindgen" -version = "0.2.78" +name = "windows-targets" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "cfg-if", - "wasm-bindgen-macro", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] -name = "wasm-bindgen-backend" -version = "0.2.78" +name = "windows_aarch64_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] -name = "wasm-bindgen-macro" -version = "0.2.78" +name = "windows_aarch64_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.78" +name = "windows_i686_gnu" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] -name = "wasm-bindgen-shared" -version = "0.2.78" +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] -name = "winapi" -version = "0.3.9" +name = "windows_i686_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" +name = "windows_x86_64_msvc" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +name = "yansi" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" @@ -16,14 +16,14 @@ include = ["src/**/*", "LICENSE", "README.md"] log = "0.4" byteorder = "1.3.2" failure = "0.1" -time = "0.2" +time = { version = "0.3", features = ["macros", "parsing", "local-offset"] } num-traits = "0.2" -num-derive = "0.3" +num-derive = "0.4" -bitflags = "1" +bitflags = "2" -itertools = "0.10" +itertools = "0.14" crossbeam-channel = "0.5" once_cell = "1" @@ -31,15 +31,21 @@ once_cell = "1" libquassel-derive = { path = "./derive" } bytes = { version = "1.0", optional = true } -flate2 = { version = "1.0", features = ["tokio"], optional = true } +flate2 = { version = "1.0", optional = true } tokio = { version = "1", features = [], optional = true } -tokio-util = { version = "0.6", features = ["codec"], optional = true } +tokio-util = { version = "0.7", features = ["codec"], optional = true } [features] framing = ["tokio", "tokio-util", "flate2", "bytes"] # Enable all the quassel features -all-quassel-features = ["long-message-id", "long-time", "rich-messages", "sender-prefixes", "authenticators"] +all-quassel-features = [ + "long-message-id", + "long-time", + "rich-messages", + "sender-prefixes", + "authenticators", +] # Either act as a client or a server client = [] @@ -73,7 +79,7 @@ futures = { version = "0.3" } # tokio = { version = "0.3", features = ["full"] } # tokio-util = { version = "0.5", features = ["codec"] } tokio-test = { version = "0.4" } -pretty_assertions = "0.6" +pretty_assertions = "1" [workspace] members = ["derive"] diff --git a/rustfmt.toml b/rustfmt.toml index 32a9786..241dc40 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1 +1,2 @@ edition = "2018" +max_width = 110 @@ -1,3 +1,4 @@ +#![allow(unused_variables, unused_imports)] #![cfg_attr(all(test, feature = "bench"), feature(test))] #[cfg(all(test, feature = "bench"))] extern crate test; diff --git a/src/message/signalproxy/objects/coreinfo.rs b/src/message/signalproxy/objects/coreinfo.rs index 7b3009a..4567762 100644 --- a/src/message/signalproxy/objects/coreinfo.rs +++ b/src/message/signalproxy/objects/coreinfo.rs @@ -1,7 +1,7 @@ use libquassel_derive::{NetworkList, NetworkMap}; use crate::message::signalproxy::translation::NetworkMap; -use crate::message::{Syncable, Class}; +use crate::message::{Class, Syncable}; use crate::primitive::{DateTime, StringList}; #[derive(Default, Debug, Clone, PartialEq, NetworkList, NetworkMap)] @@ -68,7 +68,7 @@ pub struct CoreData { #[network( rename = "sessionConnectedClientData", variant = "VariantList", - network = "map", + network = "map" )] pub session_connected_client_data: Vec<ConnectedClient>, } @@ -78,7 +78,7 @@ impl Default for CoreData { Self { quassel_version: Default::default(), quassel_build_date: Default::default(), - start_time:DateTime::unix_epoch(), + start_time: DateTime::UNIX_EPOCH, session_connected_clients: Default::default(), session_connected_client_data: Default::default(), } diff --git a/src/message/signalproxy/objects/ircuser.rs b/src/message/signalproxy/objects/ircuser.rs index b96ea95..61c4a2e 100644 --- a/src/message/signalproxy/objects/ircuser.rs +++ b/src/message/signalproxy/objects/ircuser.rs @@ -1,5 +1,5 @@ use crate::{ - message::{Syncable, Class}, + message::{Class, Syncable}, primitive::{DateTime, StringList}, }; @@ -45,7 +45,7 @@ pub struct IrcUser { impl IrcUser { pub fn add_user_modes(&mut self, modes: String) { for mode in modes.chars() { - if ! self.user_modes.contains(mode) { + if !self.user_modes.contains(mode) { self.user_modes.push(mode); } } @@ -65,12 +65,10 @@ impl IrcUser { sync!("removeUserModes", [modes]); } - pub fn update_hostmask(&mut self, mask: String) { - - } + pub fn update_hostmask(&mut self, mask: String) {} pub fn join_channel(&mut self, channel: String) { - if ! self.channels.contains(&channel) { + if !self.channels.contains(&channel) { self.channels.push(channel.clone()) } @@ -126,12 +124,12 @@ mod tests { account: s!(""), away: false, away_message: s!(""), - idle_time: OffsetDateTime::unix_epoch(), - login_time: OffsetDateTime::unix_epoch(), + idle_time: OffsetDateTime::UNIX_EPOCH, + login_time: OffsetDateTime::UNIX_EPOCH, server: s!(""), irc_operator: s!(""), // last_away_message: 0, - last_away_message_time: OffsetDateTime::unix_epoch(), + last_away_message_time: OffsetDateTime::UNIX_EPOCH, whois_service_reply: s!(""), suser_host: s!(""), encrypted: false, @@ -152,7 +150,7 @@ mod tests { s!("lastAwayMessageTime") => Variant::VariantList(vec! [ Variant::DateTime( - OffsetDateTime::unix_epoch() , + OffsetDateTime::UNIX_EPOCH, ), ], ), @@ -180,7 +178,7 @@ mod tests { s!("loginTime") => Variant::VariantList(vec! [ Variant::DateTime( - OffsetDateTime::unix_epoch() + OffsetDateTime::UNIX_EPOCH ), ], ), @@ -229,7 +227,7 @@ mod tests { s!("idleTime") => Variant::VariantList(vec! [ Variant::DateTime( - OffsetDateTime::unix_epoch() + OffsetDateTime::UNIX_EPOCH ), ], ), diff --git a/src/primitive/datetime.rs b/src/primitive/datetime.rs index 8d78b32..395830d 100644 --- a/src/primitive/datetime.rs +++ b/src/primitive/datetime.rs @@ -46,7 +46,7 @@ impl Serialize for OffsetDateTime { fn serialize(&self) -> Result<Vec<u8>, failure::Error> { let mut values: Vec<u8> = Vec::new(); - values.extend(i32::serialize(&(self.date().julian_day() as i32))?); + values.extend(i32::serialize(&(self.date().to_julian_day() as i32))?); let time: i32 = { let hour: i32 = self.time().hour() as i32; @@ -59,7 +59,7 @@ impl Serialize for OffsetDateTime { values.extend(i32::serialize(&time)?); values.extend(u8::serialize(&(TimeSpec::OffsetFromUTC as u8))?); - values.extend(i32::serialize(&self.offset().as_seconds())?); + values.extend(i32::serialize(&self.offset().whole_seconds())?); Ok(values) } @@ -77,13 +77,13 @@ impl Deserialize for OffsetDateTime { // Default to unix epoch when one of these is set to -1 if julian_day == -1 || millis_of_day == -1 { - return Ok((pos, OffsetDateTime::unix_epoch())); + return Ok((pos, OffsetDateTime::UNIX_EPOCH)); } let offset: UtcOffset; match zone { TimeSpec::LocalUnknown | TimeSpec::LocalStandard | TimeSpec::LocalDST => { - offset = UtcOffset::try_current_local_offset().unwrap_or_else(|_| { + offset = UtcOffset::current_local_offset().unwrap_or_else(|_| { log::warn!("could not get local offset defaulting to utc"); UtcOffset::UTC }) @@ -92,19 +92,18 @@ impl Deserialize for OffsetDateTime { TimeSpec::OffsetFromUTC => { let (_, tmp_offset) = i32::parse(&b[9..13])?; pos += 4; - offset = UtcOffset::seconds(tmp_offset) + offset = UtcOffset::from_whole_seconds(tmp_offset).unwrap_or(UtcOffset::UTC) } } - let date = Date::from_julian_day(julian_day as i64); + let date = Date::from_julian_day(julian_day)?; let hour = millis_of_day / 60 / 60000; let minute = (millis_of_day - (hour * 60 * 60000)) / 60000; let seconds = (millis_of_day - (hour * 60 * 60000) - (minute * 60000)) / 1000; let millis = millis_of_day - (hour * 60 * 60000) - (minute * 60000) - (seconds * 1000); - let time = - Time::try_from_hms_milli(hour as u8, minute as u8, seconds as u8, millis as u16)?; + let time = Time::from_hms_milli(hour as u8, minute as u8, seconds as u8, millis as u16)?; let primitivedatetime = PrimitiveDateTime::new(date, time); let datetime = primitivedatetime.assume_offset(offset); @@ -116,7 +115,7 @@ impl Serialize for Date { fn serialize(&self) -> Result<Vec<std::primitive::u8>, failure::Error> { let mut values: Vec<u8> = Vec::new(); - values.extend(i32::serialize(&(self.julian_day() as i32))?); + values.extend(i32::serialize(&(self.to_julian_day() as i32))?); Ok(values) } @@ -125,7 +124,7 @@ impl Serialize for Date { impl Deserialize for Date { fn parse(b: &[std::primitive::u8]) -> Result<(std::primitive::usize, Self), failure::Error> { let (_, julian_day) = i32::parse(&b[0..4])?; - let date = Date::from_julian_day(julian_day as i64); + let date = Date::from_julian_day(julian_day)?; Ok((4, date)) } @@ -159,8 +158,7 @@ impl Deserialize for Time { let seconds = (millis_of_day - (hour * 60 * 60000) - (minute * 60000)) / 1000; let millis = millis_of_day - (hour * 60 * 60000) - (minute * 60000) - (seconds * 1000); - let time = - Time::try_from_hms_milli(hour as u8, minute as u8, seconds as u8, millis as u16)?; + let time = Time::from_hms_milli(hour as u8, minute as u8, seconds as u8, millis as u16)?; Ok((4, time)) } @@ -168,7 +166,13 @@ impl Deserialize for Time { #[test] pub fn datetime_serialize() { - let datetime = DateTime::parse("2020-02-19 13:00 +0200", "%Y-%m-%d %R %z").unwrap(); + let datetime = DateTime::parse( + "2020-02-19 13:00 +0200", + time::macros::format_description!( + "[year]-[month]-[day] [hour]:[minute] [offset_hour sign:mandatory][offset_minute]" + ), + ) + .unwrap(); let sers = datetime.serialize().unwrap(); let bytes = vec![0, 37, 133, 19, 2, 202, 28, 128, 3, 0, 0, 28, 32]; @@ -178,7 +182,13 @@ pub fn datetime_serialize() { #[test] pub fn datetime_deserialize() { - let datetime = DateTime::parse("2020-02-19 13:00 +0200", "%Y-%m-%d %R %z").unwrap(); + let datetime = DateTime::parse( + "2020-02-19 13:00 +0200", + time::macros::format_description!( + "[year]-[month]-[day] [hour]:[minute] [offset_hour sign:mandatory][offset_minute]" + ), + ) + .unwrap(); let bytes = vec![0, 37, 133, 19, 2, 202, 28, 128, 3, 0, 0, 28, 32]; let (_, res): (usize, DateTime) = Deserialize::parse(&bytes).unwrap(); @@ -188,7 +198,7 @@ pub fn datetime_deserialize() { #[test] pub fn datetime_deserialize_epoch() { - let datetime = DateTime::unix_epoch(); + let datetime = DateTime::UNIX_EPOCH; let bytes = vec![0, 37, 133, 19, 0xff, 0xff, 0xff, 0xff, 3, 0, 0, 28, 32]; let (_, res): (usize, DateTime) = Deserialize::parse(&bytes).unwrap(); diff --git a/src/primitive/message.rs b/src/primitive/message.rs index 12edb29..27d60f5 100644 --- a/src/primitive/message.rs +++ b/src/primitive/message.rs @@ -198,6 +198,7 @@ impl Deserialize for Message { use bitflags::bitflags; bitflags! { + #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct MessageType: i32 { const NONE = 0x00000000; const PLAIN = 0x00000001; diff --git a/src/primitive/variant.rs b/src/primitive/variant.rs index b306ea7..46334a0 100644 --- a/src/primitive/variant.rs +++ b/src/primitive/variant.rs @@ -434,6 +434,8 @@ impl Deserialize for Variant { #[cfg(test)] mod tests { + use time::macros::format_description; + use super::*; #[test] @@ -460,10 +462,7 @@ mod tests { i_n_64.serialize().unwrap(), [0, 0, 0, 129, 0, 255, 252, 253, 100, 160, 148, 133, 168] ); - assert_eq!( - i_n_32.serialize().unwrap(), - [0, 0, 0, 2, 0, 202, 122, 245, 31] - ); + assert_eq!(i_n_32.serialize().unwrap(), [0, 0, 0, 2, 0, 202, 122, 245, 31]); assert_eq!(i_n_16.serialize().unwrap(), [0, 0, 0, 130, 0, 224, 13]); assert_eq!(i_n_8.serialize().unwrap(), [0, 0, 0, 131, 0, 178]); } @@ -496,8 +495,7 @@ mod tests { let i_n_16 = Variant::i16(-8179); let i_n_8 = Variant::i8(-78); - let (_, v_i_64) = - Variant::parse(&[0, 0, 0, 129, 0, 0, 3, 2, 155, 95, 107, 122, 88]).unwrap(); + let (_, v_i_64) = Variant::parse(&[0, 0, 0, 129, 0, 0, 3, 2, 155, 95, 107, 122, 88]).unwrap(); let (_, v_i_32) = Variant::parse(&[0, 0, 0, 2, 0, 53, 133, 10, 225]).unwrap(); let (_, v_i_16) = Variant::parse(&[0, 0, 0, 130, 0, 31, 243]).unwrap(); let (_, v_i_8) = Variant::parse(&[0, 0, 0, 131, 0, 78]).unwrap(); @@ -526,8 +524,7 @@ mod tests { let u_16 = Variant::u16(8179); let u_8 = Variant::u8(78); - let (_, v_u_64) = - Variant::parse(&[0, 0, 0, 132, 0, 0, 3, 2, 155, 95, 107, 122, 88]).unwrap(); + let (_, v_u_64) = Variant::parse(&[0, 0, 0, 132, 0, 0, 3, 2, 155, 95, 107, 122, 88]).unwrap(); let (_, v_u_32) = Variant::parse(&[0, 0, 0, 3, 0, 53, 133, 10, 225]).unwrap(); let (_, v_u_16) = Variant::parse(&[0, 0, 0, 133, 0, 31, 243]).unwrap(); let (_, v_u_8) = Variant::parse(&[0, 0, 0, 134, 0, 78]).unwrap(); @@ -579,8 +576,8 @@ mod tests { let mut test_variantmap = VariantMap::new(); test_variantmap.insert("Configured".to_string(), Variant::bool(true)); let bytes = [ - 0, 0, 0, 1, 0, 0, 0, 20, 0, 67, 0, 111, 0, 110, 0, 102, 0, 105, 0, 103, 0, 117, 0, 114, - 0, 101, 0, 100, 0, 0, 0, 1, 0, 1, + 0, 0, 0, 1, 0, 0, 0, 20, 0, 67, 0, 111, 0, 110, 0, 102, 0, 105, 0, 103, 0, 117, 0, 114, 0, 101, + 0, 100, 0, 0, 0, 1, 0, 1, ] .to_vec(); assert_eq!(test_variantmap.serialize().unwrap(), bytes); @@ -589,8 +586,8 @@ mod tests { #[test] pub fn variantmap_deserialize() { let test_bytes: &[u8] = &[ - 0, 0, 0, 1, 0, 0, 0, 20, 0, 67, 0, 111, 0, 110, 0, 102, 0, 105, 0, 103, 0, 117, 0, 114, - 0, 101, 0, 100, 0, 0, 0, 1, 0, 1, + 0, 0, 0, 1, 0, 0, 0, 20, 0, 67, 0, 111, 0, 110, 0, 102, 0, 105, 0, 103, 0, 117, 0, 114, 0, 101, + 0, 100, 0, 0, 0, 1, 0, 1, ]; let (len, res) = VariantMap::parse(test_bytes).unwrap(); let mut test_variantmap = VariantMap::new(); @@ -609,8 +606,8 @@ mod tests { }; let bytes = vec![ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x4, 0x74, 0x65, 0x73, 0x74, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x74, + 0x65, 0x73, 0x74, ]; assert_eq!(test_buffer_info.serialize().unwrap(), bytes); } @@ -625,8 +622,8 @@ mod tests { }; let bytes = vec![ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x5, 0x74, 0x65, 0x73, 0x74, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x74, + 0x65, 0x73, 0x74, 0x0, ]; let (len, res) = BufferInfo::parse(&bytes).unwrap(); @@ -636,10 +633,7 @@ mod tests { #[test] fn char_serialize() { - assert_eq!( - Variant::char('z').serialize().unwrap(), - [0, 0, 0, 7, 0, 0, 122] - ); + assert_eq!(Variant::char('z').serialize().unwrap(), [0, 0, 0, 7, 0, 0, 122]); } #[test] @@ -658,23 +652,23 @@ mod tests { assert_eq!( Variant::String(test_string.clone()).serialize().unwrap(), [ - 0, 0, 0, 10, 0, 0, 0, 0, 36, 0, 0x54, 0, 0x68, 0, 0x69, 0, 0x73, 0, 0x20, 0, 0x69, - 0, 0x73, 0, 0x20, 0, 0x61, 0, 0x20, 0, 0x54, 0, 0x65, 0, 0x73, 0, 0x74, 0, 0x21, 0, - 0x31, 0, 0x21, 0, 0x21 + 0, 0, 0, 10, 0, 0, 0, 0, 36, 0, 0x54, 0, 0x68, 0, 0x69, 0, 0x73, 0, 0x20, 0, 0x69, 0, 0x73, + 0, 0x20, 0, 0x61, 0, 0x20, 0, 0x54, 0, 0x65, 0, 0x73, 0, 0x74, 0, 0x21, 0, 0x31, 0, 0x21, 0, + 0x21 ] ); assert_eq!( Variant::ByteArray(test_string.clone()).serialize().unwrap(), [ - 0, 0, 0, 12, 0, 0, 0, 0, 18, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, - 0x20, 0x54, 0x65, 0x73, 0x74, 0x21, 0x31, 0x21, 0x21 + 0, 0, 0, 12, 0, 0, 0, 0, 18, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, + 0x54, 0x65, 0x73, 0x74, 0x21, 0x31, 0x21, 0x21 ] ); assert_eq!( Variant::StringList(test_string_list).serialize().unwrap(), [ - 0, 0, 0, 11, 0, 0, 0, 0, 2, 0, 0, 0, 10, 0, 0x74, 0, 0x65, 0, 0x73, 0, 0x74, 0, - 0x31, 0, 0, 0, 12, 0, 0x74, 0, 0x65, 0, 0x73, 0, 0x74, 0, 0x20, 0, 0x32 + 0, 0, 0, 11, 0, 0, 0, 0, 2, 0, 0, 0, 10, 0, 0x74, 0, 0x65, 0, 0x73, 0, 0x74, 0, 0x31, 0, 0, + 0, 12, 0, 0x74, 0, 0x65, 0, 0x73, 0, 0x74, 0, 0x20, 0, 0x32 ] ); } @@ -685,19 +679,18 @@ mod tests { let test_string_list = vec!["test1".to_string(), "test 2".to_string()]; let test_string_src = vec![ - 0, 0, 0, 10, 0, 0, 0, 0, 36, 0, 0x54, 0, 0x68, 0, 0x69, 0, 0x73, 0, 0x20, 0, 0x69, 0, - 0x73, 0, 0x20, 0, 0x61, 0, 0x20, 0, 0x54, 0, 0x65, 0, 0x73, 0, 0x74, 0, 0x21, 0, 0x31, - 0, 0x21, 0, 0x21, + 0, 0, 0, 10, 0, 0, 0, 0, 36, 0, 0x54, 0, 0x68, 0, 0x69, 0, 0x73, 0, 0x20, 0, 0x69, 0, 0x73, 0, + 0x20, 0, 0x61, 0, 0x20, 0, 0x54, 0, 0x65, 0, 0x73, 0, 0x74, 0, 0x21, 0, 0x31, 0, 0x21, 0, 0x21, ]; let test_string_src_utf8 = vec![ - 0, 0, 0, 12, 0, 0, 0, 0, 18, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, - 0x20, 0x54, 0x65, 0x73, 0x74, 0x21, 0x31, 0x21, 0x21, 0, + 0, 0, 0, 12, 0, 0, 0, 0, 18, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x54, + 0x65, 0x73, 0x74, 0x21, 0x31, 0x21, 0x21, 0, ]; let test_string_list_src = vec![ - 0, 0, 0, 11, 0, 0, 0, 0, 2, 0, 0, 0, 10, 0, 0x74, 0, 0x65, 0, 0x73, 0, 0x74, 0, 0x31, - 0, 0, 0, 12, 0, 0x74, 0, 0x65, 0, 0x73, 0, 0x74, 0, 0x20, 0, 0x32, + 0, 0, 0, 11, 0, 0, 0, 0, 2, 0, 0, 0, 10, 0, 0x74, 0, 0x65, 0, 0x73, 0, 0x74, 0, 0x31, 0, 0, 0, + 12, 0, 0x74, 0, 0x65, 0, 0x73, 0, 0x74, 0, 0x20, 0, 0x32, ]; assert_eq!( @@ -716,38 +709,49 @@ mod tests { #[test] fn datetime_serialize() { - let datetime = - Variant::DateTime(DateTime::parse("2020-02-19 13:00 +0200", "%Y-%m-%d %R %z").unwrap()); - let date = Variant::Date(Date::parse("2020-02-19", "%Y-%m-%d").unwrap()); - let time = Variant::Time(Time::parse("13:00", "%R").unwrap()); + let datetime = Variant::DateTime( + DateTime::parse( + "2020-02-19 13:00 +0200", + format_description!( + "[year]-[month]-[day] [hour]:[minute] [offset_hour sign:mandatory][offset_minute]" + ), + ) + .unwrap(), + ); + + let date = + Variant::Date(Date::parse("2020-02-19", format_description!("[year]-[month]-[day]")).unwrap()); + let time = Variant::Time(Time::parse("13:00", format_description!("[hour]:[minute]")).unwrap()); assert_eq!( datetime.serialize().unwrap(), [0, 0, 0, 0x10, 0, 0, 37, 133, 19, 2, 202, 28, 128, 3, 0, 0, 28, 32] ); - assert_eq!( - date.serialize().unwrap(), - [0, 0, 0, 0x0e, 0, 0, 37, 133, 19] - ); + assert_eq!(date.serialize().unwrap(), [0, 0, 0, 0x0e, 0, 0, 37, 133, 19]); - assert_eq!( - time.serialize().unwrap(), - [0, 0, 0, 0x0f, 0, 2, 202, 28, 128] - ); + assert_eq!(time.serialize().unwrap(), [0, 0, 0, 0x0f, 0, 2, 202, 28, 128]); } #[test] fn datetime_deserialize() { - let datetime = - Variant::DateTime(DateTime::parse("2020-02-19 13:00 +0200", "%Y-%m-%d %R %z").unwrap()); - let date = Variant::Date(Date::parse("2020-02-19", "%Y-%m-%d").unwrap()); - let time = Variant::Time(Time::parse("13:00", "%R").unwrap()); + let datetime = Variant::DateTime( + DateTime::parse( + "2020-02-19 13:00 +0200", + format_description!( + "[year]-[month]-[day] [hour]:[minute] [offset_hour sign:mandatory][offset_minute]" + ), + ) + .unwrap(), + ); + + let date = + Variant::Date(Date::parse("2020-02-19", format_description!("[year]-[month]-[day]")).unwrap()); + let time = Variant::Time(Time::parse("13:00", format_description!("[hour]:[minute]")).unwrap()); assert_eq!( (18, datetime), - Variant::parse(&[0, 0, 0, 0x10, 0, 0, 37, 133, 19, 2, 202, 28, 128, 3, 0, 0, 28, 32]) - .unwrap() + Variant::parse(&[0, 0, 0, 0x10, 0, 0, 37, 133, 19, 2, 202, 28, 128, 3, 0, 0, 28, 32]).unwrap() ); assert_eq!( |
