feat: add telemetry subcrate #15
29 changed files with 1643 additions and 92 deletions
499
Cargo.lock
generated
499
Cargo.lock
generated
|
@ -31,7 +31,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"getrandom 0.2.15",
|
||||
"getrandom 0.2.16",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
"zerocopy 0.7.35",
|
||||
|
@ -173,14 +173,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "async-executor"
|
||||
version = "1.13.1"
|
||||
version = "1.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec"
|
||||
checksum = "bb812ffb58524bdd10860d7d974e2f01cc0950c2438a74ee5ec2e2280c6c4ffa"
|
||||
dependencies = [
|
||||
"async-task",
|
||||
"concurrent-queue",
|
||||
"fastrand",
|
||||
"futures-lite",
|
||||
"pin-project-lite",
|
||||
"slab",
|
||||
]
|
||||
|
||||
|
@ -300,7 +301,7 @@ dependencies = [
|
|||
"anyhow",
|
||||
"arrayvec",
|
||||
"log",
|
||||
"nom",
|
||||
"nom 7.1.3",
|
||||
"num-rational",
|
||||
"v_frame",
|
||||
]
|
||||
|
@ -398,9 +399,9 @@ checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
|
|||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.22.0"
|
||||
version = "1.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540"
|
||||
checksum = "9134a6ef01ce4b366b50689c94f82c14bc72bc5d0386829828a2e2752ef7958c"
|
||||
dependencies = [
|
||||
"bytemuck_derive",
|
||||
]
|
||||
|
@ -456,9 +457,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.19"
|
||||
version = "1.2.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e3a13707ac958681c13b39b458c073d0d9bc8a22cb1b2f4c8e55eb72c13f362"
|
||||
checksum = "04da6a0d40b948dfc4fa8f5bbf402b0fc1a64a28dbf7d12ffd683550f2c1b63a"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
|
@ -505,14 +506,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.40"
|
||||
version = "0.4.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c"
|
||||
checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
"serde",
|
||||
"wasm-bindgen",
|
||||
"windows-link",
|
||||
]
|
||||
|
@ -563,6 +565,16 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.7"
|
||||
|
@ -576,8 +588,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
"core-graphics-types",
|
||||
"core-foundation 0.9.4",
|
||||
"core-graphics-types 0.1.3",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
]
|
||||
|
@ -589,7 +601,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"core-foundation",
|
||||
"core-foundation 0.9.4",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics-types"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"core-foundation 0.10.0",
|
||||
"libc",
|
||||
]
|
||||
|
||||
|
@ -648,6 +671,12 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991"
|
||||
|
||||
[[package]]
|
||||
name = "detect-desktop-environment"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff7f16599c3ba6b4ab9a3195bcd9413a7ee8d51e7651f3e9efd6a5db5315008d"
|
||||
|
||||
[[package]]
|
||||
name = "diff"
|
||||
version = "0.1.13"
|
||||
|
@ -660,6 +689,16 @@ version = "0.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
|
||||
|
||||
[[package]]
|
||||
name = "dispatch2"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"objc2 0.6.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dlib"
|
||||
version = "0.5.2"
|
||||
|
@ -849,9 +888,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.15"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
||||
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
|
@ -940,7 +979,7 @@ dependencies = [
|
|||
"log",
|
||||
"presser",
|
||||
"thiserror 1.0.69",
|
||||
"windows",
|
||||
"windows 0.58.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1010,6 +1049,28 @@ version = "0.2.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
||||
|
||||
[[package]]
|
||||
name = "hidapi"
|
||||
version = "2.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03b876ecf37e86b359573c16c8366bc3eba52b689884a0fc42ba3f67203d2a8b"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "humansize"
|
||||
version = "2.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7"
|
||||
dependencies = [
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iana-time-zone"
|
||||
version = "0.1.63"
|
||||
|
@ -1022,7 +1083,7 @@ dependencies = [
|
|||
"js-sys",
|
||||
"log",
|
||||
"wasm-bindgen",
|
||||
"windows-core",
|
||||
"windows-core 0.61.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1094,6 +1155,15 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "isolang"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe50d48c77760c55188549098b9a7f6e37ae980c586a24693d6b01c3b2010c3c"
|
||||
dependencies = [
|
||||
"phf",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.12.1"
|
||||
|
@ -1103,6 +1173,15 @@ dependencies = [
|
|||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.15"
|
||||
|
@ -1188,9 +1267,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.171"
|
||||
version = "0.2.172"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
|
||||
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
|
||||
|
||||
[[package]]
|
||||
name = "libfuzzer-sys"
|
||||
|
@ -1214,9 +1293,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.11"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa"
|
||||
checksum = "c9627da5196e5d8ed0b0495e61e518847578da83483c37288316d9b2e03a7f72"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
|
@ -1317,7 +1396,22 @@ checksum = "f569fb946490b5743ad69813cb19629130ce9374034abe31614a36402d18f99e"
|
|||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"block",
|
||||
"core-graphics-types",
|
||||
"core-graphics-types 0.1.3",
|
||||
"foreign-types",
|
||||
"log",
|
||||
"objc",
|
||||
"paste",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "metal"
|
||||
version = "0.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00c15a6f673ff72ddcc22394663290f870fb224c1bfce55734a75c414150e605"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"block",
|
||||
"core-graphics-types 0.2.0",
|
||||
"foreign-types",
|
||||
"log",
|
||||
"objc",
|
||||
|
@ -1421,12 +1515,30 @@ dependencies = [
|
|||
"minimal-lexical",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "8.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "noop_proc_macro"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
|
||||
|
||||
[[package]]
|
||||
name = "ntapi"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.46.0"
|
||||
|
@ -1536,9 +1648,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "objc2"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3531f65190d9cff863b77a99857e74c314dd16bf56c538c4b57c7cbc3f3a6e59"
|
||||
checksum = "88c6597e14493ab2e44ce58f2fdecf095a51f12ca57bec060a11c57332520551"
|
||||
dependencies = [
|
||||
"objc2-encode",
|
||||
]
|
||||
|
@ -1597,12 +1709,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "objc2-core-foundation"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "daeaf60f25471d26948a1c2f840e3f7d86f4109e3af4e8e4b5cd70c39690d925"
|
||||
checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"objc2 0.6.0",
|
||||
"dispatch2",
|
||||
"objc2 0.6.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1650,12 +1763,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "objc2-foundation"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a21c6c9014b82c39515db5b396f91645182611c97d24637cf56ac01e5f8d998"
|
||||
checksum = "900831247d2fe1a09a683278e5384cfb8c80c79fe6b166f9d14bfdde0ea1b03c"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"objc2 0.6.0",
|
||||
"objc2 0.6.1",
|
||||
"objc2-core-foundation",
|
||||
]
|
||||
|
||||
|
@ -1685,13 +1798,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "objc2-metal"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01c41bc8b0e50ea7a5304a56f25e0066f526e99641b46fd7b9ad4421dd35bff6"
|
||||
checksum = "7f246c183239540aab1782457b35ab2040d4259175bd1d0c58e46ada7b47a874"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"objc2 0.6.0",
|
||||
"objc2-foundation 0.3.0",
|
||||
"objc2 0.6.1",
|
||||
"objc2-foundation 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1709,15 +1822,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "objc2-quartz-core"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fb3794501bb1bee12f08dcad8c61f2a5875791ad1c6f47faa71a0f033f20071"
|
||||
checksum = "90ffb6a0cd5f182dc964334388560b12a57f7b74b3e2dec5e2722aa2dfb2ccd5"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"objc2 0.6.0",
|
||||
"objc2 0.6.1",
|
||||
"objc2-core-foundation",
|
||||
"objc2-foundation 0.3.0",
|
||||
"objc2-metal 0.3.0",
|
||||
"objc2-foundation 0.3.1",
|
||||
"objc2-metal 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1867,6 +1980,24 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
|
||||
dependencies = [
|
||||
"phf_shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_shared"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
|
||||
dependencies = [
|
||||
"siphasher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.10"
|
||||
|
@ -1950,7 +2081,7 @@ version = "0.2.21"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
|
||||
dependencies = [
|
||||
"zerocopy 0.8.24",
|
||||
"zerocopy 0.8.25",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1980,9 +2111,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.94"
|
||||
version = "1.0.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
|
||||
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
@ -2023,9 +2154,9 @@ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
|
|||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.37.4"
|
||||
version = "0.37.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4ce8c88de324ff838700f36fb6ab86c96df0e3c4ab6ef3a9b2044465cce1369"
|
||||
checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
@ -2072,7 +2203,7 @@ version = "0.6.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom 0.2.15",
|
||||
"getrandom 0.2.16",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2095,7 +2226,7 @@ dependencies = [
|
|||
"built",
|
||||
"cfg-if",
|
||||
"interpolate_name",
|
||||
"itertools",
|
||||
"itertools 0.12.1",
|
||||
"libc",
|
||||
"libfuzzer-sys",
|
||||
"log",
|
||||
|
@ -2143,10 +2274,10 @@ version = "1.1.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135"
|
||||
dependencies = [
|
||||
"objc2 0.6.0",
|
||||
"objc2 0.6.1",
|
||||
"objc2-core-foundation",
|
||||
"objc2-foundation 0.3.0",
|
||||
"objc2-quartz-core 0.3.0",
|
||||
"objc2-foundation 0.3.1",
|
||||
"objc2-quartz-core 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2370,9 +2501,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.2"
|
||||
version = "1.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1"
|
||||
checksum = "9203b8055f63a2a00e2f593bb0510367fe707d7ff1e5c872de2f537b339e5410"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
@ -2392,6 +2523,12 @@ dependencies = [
|
|||
"quote",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d"
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.9"
|
||||
|
@ -2518,15 +2655,38 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.100"
|
||||
version = "2.0.101"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0"
|
||||
checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sys-locale"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sysinfo"
|
||||
version = "0.34.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4b93974b3d3aeaa036504b8eefd4c039dced109171c1ae973f1dc63b2c7e4b2"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"memchr",
|
||||
"ntapi",
|
||||
"objc2-core-foundation",
|
||||
"serde",
|
||||
"windows 0.57.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-deps"
|
||||
version = "6.2.2"
|
||||
|
@ -2546,6 +2706,27 @@ version = "0.12.16"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
||||
|
||||
[[package]]
|
||||
name = "telemetry"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"ash",
|
||||
"chrono",
|
||||
"detect-desktop-environment",
|
||||
"hidapi",
|
||||
"humansize",
|
||||
"metal 0.32.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sys-locale",
|
||||
"sysinfo",
|
||||
"timeago",
|
||||
"versions",
|
||||
"wgpu",
|
||||
"winit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.4.1"
|
||||
|
@ -2622,6 +2803,16 @@ dependencies = [
|
|||
"weezl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "timeago"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1710e589de0a76aaf295cd47a6699f6405737dbfd3cf2b75c92d000b548d0e6"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"isolang",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tiny-skia"
|
||||
version = "0.11.4"
|
||||
|
@ -2658,9 +2849,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.20"
|
||||
version = "0.8.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148"
|
||||
checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
|
@ -2670,18 +2861,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "0.6.8"
|
||||
version = "0.6.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
|
||||
checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.24"
|
||||
version = "0.22.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474"
|
||||
checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
|
@ -2804,6 +2995,17 @@ version = "0.9.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "versions"
|
||||
version = "7.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80a7e511ce1795821207a837b7b1c8d8aca0c648810966ad200446ae58f6667f"
|
||||
dependencies = [
|
||||
"itertools 0.14.0",
|
||||
"nom 8.0.0",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vk-parse"
|
||||
version = "0.15.0"
|
||||
|
@ -2827,7 +3029,7 @@ dependencies = [
|
|||
"heck 0.4.1",
|
||||
"indexmap",
|
||||
"libloading",
|
||||
"nom",
|
||||
"nom 7.1.3",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"proc-macro2",
|
||||
|
@ -2955,9 +3157,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wayland-backend"
|
||||
version = "0.3.8"
|
||||
version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7208998eaa3870dad37ec8836979581506e0c5c64c20c9e79e9d2a10d6f47bf"
|
||||
checksum = "fe770181423e5fc79d3e2a7f4410b7799d5aab1de4372853de3c6aa13ca24121"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"downcast-rs",
|
||||
|
@ -2969,9 +3171,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
version = "0.31.8"
|
||||
version = "0.31.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2120de3d33638aaef5b9f4472bff75f07c56379cf76ea320bd3a3d65ecaf73f"
|
||||
checksum = "978fa7c67b0847dbd6a9f350ca2569174974cd4082737054dbb7fbb79d7d9a61"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"rustix",
|
||||
|
@ -2992,9 +3194,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wayland-cursor"
|
||||
version = "0.31.8"
|
||||
version = "0.31.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a93029cbb6650748881a00e4922b076092a6a08c11e7fbdb923f064b23968c5d"
|
||||
checksum = "a65317158dec28d00416cb16705934070aef4f8393353d41126c54264ae0f182"
|
||||
dependencies = [
|
||||
"rustix",
|
||||
"wayland-client",
|
||||
|
@ -3003,9 +3205,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wayland-protocols"
|
||||
version = "0.32.6"
|
||||
version = "0.32.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0781cf46869b37e36928f7b432273c0995aa8aed9552c556fb18754420541efc"
|
||||
checksum = "779075454e1e9a521794fed15886323ea0feda3f8b0fc1390f5398141310422a"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"wayland-backend",
|
||||
|
@ -3015,9 +3217,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wayland-protocols-plasma"
|
||||
version = "0.3.6"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ccaacc76703fefd6763022ac565b590fcade92202492381c95b2edfdf7d46b3"
|
||||
checksum = "4fd38cdad69b56ace413c6bcc1fbf5acc5e2ef4af9d5f8f1f9570c0c83eae175"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"wayland-backend",
|
||||
|
@ -3028,9 +3230,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wayland-protocols-wlr"
|
||||
version = "0.3.6"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "248a02e6f595aad796561fa82d25601bd2c8c3b145b1c7453fc8f94c1a58f8b2"
|
||||
checksum = "1cb6cdc73399c0e06504c437fe3cf886f25568dd5454473d565085b36d6a8bbf"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
"wayland-backend",
|
||||
|
@ -3190,7 +3392,7 @@ dependencies = [
|
|||
"bytemuck",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"core-graphics-types",
|
||||
"core-graphics-types 0.1.3",
|
||||
"glow",
|
||||
"glutin_wgl_sys",
|
||||
"gpu-alloc",
|
||||
|
@ -3202,7 +3404,7 @@ dependencies = [
|
|||
"libc",
|
||||
"libloading",
|
||||
"log",
|
||||
"metal",
|
||||
"metal 0.31.0",
|
||||
"naga",
|
||||
"ndk-sys 0.5.0+25.2.9519653",
|
||||
"objc",
|
||||
|
@ -3218,8 +3420,8 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
"wgpu-types",
|
||||
"windows",
|
||||
"windows-core",
|
||||
"windows 0.58.0",
|
||||
"windows-core 0.58.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3267,13 +3469,35 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
|
||||
dependencies = [
|
||||
"windows-core 0.57.0",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.58.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
|
||||
dependencies = [
|
||||
"windows-core",
|
||||
"windows-core 0.58.0",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
|
||||
dependencies = [
|
||||
"windows-implement 0.57.0",
|
||||
"windows-interface 0.57.0",
|
||||
"windows-result 0.1.2",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
|
@ -3283,13 +3507,37 @@ version = "0.58.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
|
||||
dependencies = [
|
||||
"windows-implement",
|
||||
"windows-interface",
|
||||
"windows-result",
|
||||
"windows-strings",
|
||||
"windows-implement 0.58.0",
|
||||
"windows-interface 0.58.0",
|
||||
"windows-result 0.2.0",
|
||||
"windows-strings 0.1.0",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.61.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980"
|
||||
dependencies = [
|
||||
"windows-implement 0.60.0",
|
||||
"windows-interface 0.59.1",
|
||||
"windows-link",
|
||||
"windows-result 0.3.2",
|
||||
"windows-strings 0.4.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.58.0"
|
||||
|
@ -3301,6 +3549,28 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-implement"
|
||||
version = "0.60.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.57.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.58.0"
|
||||
|
@ -3312,12 +3582,32 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-interface"
|
||||
version = "0.59.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.2.0"
|
||||
|
@ -3327,16 +3617,34 @@ dependencies = [
|
|||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-strings"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
|
||||
dependencies = [
|
||||
"windows-result",
|
||||
"windows-result 0.2.0",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-strings"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.45.0"
|
||||
|
@ -3346,6 +3654,15 @@ dependencies = [
|
|||
"windows-targets 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
|
@ -3557,7 +3874,7 @@ dependencies = [
|
|||
"calloop",
|
||||
"cfg_aliases",
|
||||
"concurrent-queue",
|
||||
"core-foundation",
|
||||
"core-foundation 0.9.4",
|
||||
"core-graphics",
|
||||
"cursor-icon",
|
||||
"dpi",
|
||||
|
@ -3596,9 +3913,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.6"
|
||||
version = "0.7.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63d3fcd9bba44b03821e7d699eeee959f3126dcc4aa8e4ae18ec617c2a5cea10"
|
||||
checksum = "6cb8234a863ea0e8cd7284fcdd4f145233eb00fee02bbdd9861aec44e6477bc5"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
@ -3689,6 +4006,8 @@ dependencies = [
|
|||
"bytemuck",
|
||||
"cgmath",
|
||||
"image",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"smol",
|
||||
"terminator",
|
||||
"thiserror 2.0.12",
|
||||
|
@ -3712,11 +4031,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.24"
|
||||
version = "0.8.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879"
|
||||
checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb"
|
||||
dependencies = [
|
||||
"zerocopy-derive 0.8.24",
|
||||
"zerocopy-derive 0.8.25",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3732,9 +4051,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.24"
|
||||
version = "0.8.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be"
|
||||
checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
@ -15,7 +15,7 @@ crate-type = ["cdylib"]
|
|||
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = ["subcrates/renderer", "subcrates/zlog"]
|
||||
members = ["subcrates/renderer", "subcrates/telemetry", "subcrates/zlog"]
|
||||
|
||||
[workspace.dependencies]
|
||||
zlog = { path = "subcrates/zlog" }
|
||||
|
@ -55,6 +55,8 @@ vulkano = "0.35.1"
|
|||
wgpu = { version = "25.0.0", features = ["spirv"] }
|
||||
zlog.workspace = true
|
||||
allocator-api2 = "0.2.21"
|
||||
serde_json = "1.0.140"
|
||||
serde = "1.0.219"
|
||||
|
||||
[target.aarch64-linux-android.dependencies]
|
||||
winit = { version = "0.30.9", features = ["android-native-activity"] }
|
||||
|
|
|
@ -1 +1 @@
|
|||
include!("main.rs");
|
||||
include!("main.rs");
|
||||
|
24
subcrates/telemetry/Cargo.toml
Normal file
24
subcrates/telemetry/Cargo.toml
Normal file
|
@ -0,0 +1,24 @@
|
|||
[package]
|
||||
name = "telemetry"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.98"
|
||||
ash = "0.38.0"
|
||||
chrono = { version = "0.4.40", features = ["serde"] }
|
||||
detect-desktop-environment = "1.2.0"
|
||||
hidapi = "2.6.3"
|
||||
humansize = "2.1.3"
|
||||
metal = { version = "0.32.0", optional = true }
|
||||
serde = { version = "1.0.219", features = ["derive"] }
|
||||
serde_json = "1.0.140"
|
||||
sys-locale = "0.3.2"
|
||||
sysinfo = { version = "0.34.2", features = ["serde"] }
|
||||
timeago = "0.4.2"
|
||||
versions = { version = "7.0.0", features = ["serde"] }
|
||||
wgpu = "25.0.0"
|
||||
winit = "0.30.9"
|
||||
|
||||
[features]
|
||||
metal = ["dep:metal"]
|
21
subcrates/telemetry/build.rs
Normal file
21
subcrates/telemetry/build.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
use std::{env, fs::File, io::Write, process::Command};
|
||||
|
||||
fn main() {
|
||||
let out_dir = env::var("OUT_DIR").unwrap();
|
||||
let mut f = File::create(format!("{}/built.rs", out_dir)).unwrap();
|
||||
|
||||
let commit_hash = Command::new("git")
|
||||
.args(["rev-parse", "HEAD"])
|
||||
.output()
|
||||
.ok()
|
||||
.and_then(|o| String::from_utf8(o.stdout).ok())
|
||||
.unwrap_or_else(|| "unknown".into());
|
||||
|
||||
writeln!(f, "#[allow(dead_code)]").unwrap();
|
||||
writeln!(
|
||||
f,
|
||||
"pub const GIT_COMMIT_HASH: &str = \"{}\";",
|
||||
commit_hash.trim()
|
||||
)
|
||||
.unwrap();
|
||||
}
|
48
subcrates/telemetry/src/lib.rs
Normal file
48
subcrates/telemetry/src/lib.rs
Normal file
|
@ -0,0 +1,48 @@
|
|||
use serde::Serialize;
|
||||
use serde_json::{Value, json};
|
||||
#[macro_use]
|
||||
mod modules;
|
||||
use crate::modules::{cpu, devices, external, gpu, memory, meta, network, os, storage, uptime};
|
||||
use anyhow::Result;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct TelemetryInfo {
|
||||
telemetry: AllInfo,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct AllInfo {
|
||||
gpu: gpu::GPUInfo,
|
||||
cpu: cpu::CPUInfo,
|
||||
memory: memory::MemoryInfo,
|
||||
os: os::OSInfo,
|
||||
storage: Vec<storage::StorageInfo>,
|
||||
network: network::NetworkInfo,
|
||||
external: external::ExternalInfo,
|
||||
devices: devices::DevicesInfo,
|
||||
meta: meta::MetaInfo,
|
||||
uptime: uptime::UptimeInfo,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_struct() -> Result<TelemetryInfo> {
|
||||
Ok(TelemetryInfo {
|
||||
telemetry: AllInfo {
|
||||
gpu: gpu::get_struct(),
|
||||
cpu: cpu::get_struct(),
|
||||
memory: memory::get_struct(),
|
||||
os: os::get_struct()?,
|
||||
storage: storage::get_list()?,
|
||||
network: network::get_struct(),
|
||||
external: external::get_struct(),
|
||||
devices: devices::get_struct()?,
|
||||
meta: meta::get_struct()?,
|
||||
uptime: uptime::get_struct()?,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_json() -> Result<Value> {
|
||||
Ok(json!(get_struct()?))
|
||||
}
|
3
subcrates/telemetry/src/main.rs
Normal file
3
subcrates/telemetry/src/main.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
lily
commented
This file should not be in the subcrate. This file should not be in the subcrate.
|
||||
println!("{:#?}", telemetry::get_struct());
|
||||
}
|
69
subcrates/telemetry/src/modules/cpu.rs
Normal file
69
subcrates/telemetry/src/modules/cpu.rs
Normal file
|
@ -0,0 +1,69 @@
|
|||
use super::Defaults::Unknown;
|
||||
use serde::Serialize;
|
||||
use serde_json::{Value, json};
|
||||
use std::collections::HashMap;
|
||||
use sysinfo::{CpuRefreshKind, RefreshKind, System};
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct ProcessorInfo {
|
||||
vendor: String,
|
||||
brand: String,
|
||||
total_system_cores: String,
|
||||
threads: u16,
|
||||
architecture: String,
|
||||
byte_order: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct CPUInfo {
|
||||
cpus: Vec<ProcessorInfo>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_struct() -> CPUInfo {
|
||||
let system =
|
||||
System::new_with_specifics(RefreshKind::nothing().with_cpu(CpuRefreshKind::everything()));
|
||||
|
||||
let mut processors = Vec::new();
|
||||
let mut processor_count: HashMap<String, ProcessorInfo> = HashMap::new();
|
||||
|
||||
for cpu in system.cpus() {
|
||||
let brand = cpu.brand().trim();
|
||||
let total_cores = System::physical_core_count();
|
||||
|
||||
if processor_count.contains_key(brand) {
|
||||
processor_count.get_mut(brand).unwrap().threads += 1;
|
||||
continue;
|
||||
}
|
||||
processor_count.insert(
|
||||
brand.to_string(),
|
||||
ProcessorInfo {
|
||||
vendor: cpu.vendor_id().trim().to_string(),
|
||||
brand: brand.to_string(),
|
||||
total_system_cores: if let Some(cores) = total_cores {
|
||||
cores.to_string()
|
||||
} else {
|
||||
Unknown.into()
|
||||
},
|
||||
threads: 1,
|
||||
architecture: System::cpu_arch().trim().to_string(),
|
||||
byte_order: if cfg!(target_endian = "little") {
|
||||
String::from("little-endian")
|
||||
} else {
|
||||
String::from("big-endian")
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
for (_brand, info) in processor_count {
|
||||
processors.push(info);
|
||||
}
|
||||
|
||||
CPUInfo { cpus: processors }
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_json() -> Value {
|
||||
json!(get_struct())
|
||||
}
|
59
subcrates/telemetry/src/modules/devices.rs
Normal file
59
subcrates/telemetry/src/modules/devices.rs
Normal file
|
@ -0,0 +1,59 @@
|
|||
//use crate::custom_anyhow;
|
||||
use anyhow::Result;
|
||||
use serde::Serialize;
|
||||
use serde_json::{Value, json};
|
||||
extern crate hidapi;
|
||||
use hidapi::HidApi;
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct DeviceInfo {
|
||||
manufacturer: String,
|
||||
products: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct DevicesInfo {
|
||||
devices: Vec<DeviceInfo>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_struct() -> Result<DevicesInfo> {
|
||||
let api = HidApi::new().unwrap();
|
||||
let mut grouped_devices: HashMap<String, Vec<String>> = HashMap::new();
|
||||
|
||||
for device in api.device_list() {
|
||||
let manufacturer = device
|
||||
.manufacturer_string()
|
||||
.unwrap_or("Unknown")
|
||||
.to_string()
|
||||
.to_lowercase();
|
||||
let product = device.product_string().unwrap_or("Unknown").to_string();
|
||||
|
||||
if !manufacturer.trim().is_empty() && !product.trim().is_empty() {
|
||||
let entry = grouped_devices.entry(manufacturer).or_default();
|
||||
|
||||
if !entry.contains(&product) {
|
||||
entry.push(product);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mut devices = Vec::new();
|
||||
let mut grouped_vec: Vec<_> = grouped_devices.into_iter().collect();
|
||||
grouped_vec.sort_by(|a, b| a.0.to_lowercase().cmp(&b.0.to_lowercase()));
|
||||
|
||||
for (manufacturer, products) in grouped_vec {
|
||||
devices.push(DeviceInfo {
|
||||
manufacturer,
|
||||
products,
|
||||
});
|
||||
}
|
||||
|
||||
Ok(DevicesInfo { devices })
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_json() -> Result<Value> {
|
||||
Ok(json!(get_struct()?))
|
||||
}
|
63
subcrates/telemetry/src/modules/external.rs
Normal file
63
subcrates/telemetry/src/modules/external.rs
Normal file
|
@ -0,0 +1,63 @@
|
|||
use serde::Serialize;
|
||||
use serde_json::{Value, json};
|
||||
use std::{cmp::Ordering::Equal, collections::HashMap};
|
||||
use sysinfo::{System, Users};
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct SoftwareInfo {
|
||||
name: String,
|
||||
count: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct ExternalInfo {
|
||||
softwares: Vec<SoftwareInfo>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_struct() -> ExternalInfo {
|
||||
let mut system = System::new_all();
|
||||
system.refresh_all();
|
||||
|
||||
let users = &Users::new_with_refreshed_list();
|
||||
let mut grouped_processes: HashMap<String, Vec<i32>> = HashMap::new();
|
||||
|
||||
for process in system.processes().values() {
|
||||
let name = process.name().to_str().unwrap().to_string();
|
||||
let user_id = process.user_id();
|
||||
let is_user_owned = user_id.is_some_and(|uid| {
|
||||
users
|
||||
.list()
|
||||
.iter()
|
||||
.any(|u| u.id() == uid && u.name() != "root")
|
||||
});
|
||||
|
||||
if is_user_owned && !name.trim().is_empty() && !name.starts_with('[') {
|
||||
grouped_processes
|
||||
.entry(name)
|
||||
.or_default()
|
||||
.push(process.pid().as_u32() as i32);
|
||||
}
|
||||
}
|
||||
|
||||
let mut softwares = Vec::new();
|
||||
let mut grouped_vec: Vec<_> = grouped_processes.into_iter().collect();
|
||||
grouped_vec.sort_by(|a, b| match b.1.len().cmp(&a.1.len()) {
|
||||
Equal => a.0.to_lowercase().cmp(&b.0.to_lowercase()),
|
||||
other => other,
|
||||
});
|
||||
|
||||
for (name, pids) in grouped_vec {
|
||||
softwares.push(SoftwareInfo {
|
||||
name,
|
||||
count: pids.len(),
|
||||
});
|
||||
}
|
||||
|
||||
ExternalInfo { softwares }
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_json() -> Value {
|
||||
json!(get_struct())
|
||||
}
|
55
subcrates/telemetry/src/modules/formatted/architecture.rs
Normal file
55
subcrates/telemetry/src/modules/formatted/architecture.rs
Normal file
|
@ -0,0 +1,55 @@
|
|||
use serde::Serialize;
|
||||
use std::{
|
||||
fmt::{Debug, Display, Formatter, Result as FmtResult},
|
||||
ops::Deref,
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Serialize)]
|
||||
pub enum TargetPointerWidth {
|
||||
W32Bit,
|
||||
W64Bit,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct FmtOSArchitecture(pub TargetPointerWidth);
|
||||
|
||||
impl FmtOSArchitecture {
|
||||
pub const W32_BIT: Self = FmtOSArchitecture(TargetPointerWidth::W32Bit);
|
||||
pub const W64_BIT: Self = FmtOSArchitecture(TargetPointerWidth::W64Bit);
|
||||
}
|
||||
|
||||
impl Display for FmtOSArchitecture {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
write!(
|
||||
f,
|
||||
"{}",
|
||||
match self.0 {
|
||||
TargetPointerWidth::W32Bit => "32 Bit",
|
||||
TargetPointerWidth::W64Bit => "64 Bit",
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for FmtOSArchitecture {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
Display::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for FmtOSArchitecture {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
serializer.serialize_str(&self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for FmtOSArchitecture {
|
||||
type Target = TargetPointerWidth;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
38
subcrates/telemetry/src/modules/formatted/bytes.rs
Normal file
38
subcrates/telemetry/src/modules/formatted/bytes.rs
Normal file
|
@ -0,0 +1,38 @@
|
|||
use serde::Serialize;
|
||||
use std::{
|
||||
fmt::{Debug, Display, Formatter, Result as FmtResult},
|
||||
ops::Deref,
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct FmtBytes(pub u64);
|
||||
|
||||
impl Display for FmtBytes {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
use humansize::{DECIMAL, format_size};
|
||||
write!(f, "{}", format_size(self.0, DECIMAL))
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for FmtBytes {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
Display::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for FmtBytes {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
serializer.serialize_str(&self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for FmtBytes {
|
||||
type Target = u64;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
125
subcrates/telemetry/src/modules/formatted/date_time.rs
Normal file
125
subcrates/telemetry/src/modules/formatted/date_time.rs
Normal file
|
@ -0,0 +1,125 @@
|
|||
use chrono::{DateTime, Local, TimeZone, Utc};
|
||||
use serde::Serialize;
|
||||
use std::{
|
||||
fmt::{Debug, Display, Formatter, Result as FMTResult},
|
||||
ops::Deref,
|
||||
};
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct DateTimeInfo {
|
||||
date: String,
|
||||
time: String,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct FmtDateTime<Tz: TimeZone>(pub DateTime<Tz>);
|
||||
|
||||
impl<Tz: TimeZone> Display for FmtDateTime<Tz>
|
||||
where
|
||||
Tz: TimeZone,
|
||||
Tz::Offset: std::fmt::Display,
|
||||
{
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FMTResult {
|
||||
write!(
|
||||
f,
|
||||
"{:#?}",
|
||||
DateTimeInfo {
|
||||
date: self.0.format("%Y-%m-%d").to_string(),
|
||||
time: self.0.format("%H:%M:%S").to_string()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<Tz: TimeZone> Debug for FmtDateTime<Tz>
|
||||
where
|
||||
Tz::Offset: std::fmt::Display,
|
||||
{
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FMTResult {
|
||||
Display::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl<Tz: TimeZone> Serialize for FmtDateTime<Tz>
|
||||
where
|
||||
DateTime<Tz>: Display,
|
||||
{
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
serializer.serialize_str(&self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl<Tz: TimeZone> Deref for FmtDateTime<Tz> {
|
||||
type Target = DateTime<Tz>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<Tz: TimeZone> Eq for FmtDateTime<Tz> where DateTime<Tz>: Eq {}
|
||||
impl<Tz: TimeZone> PartialEq for FmtDateTime<Tz>
|
||||
where
|
||||
DateTime<Tz>: PartialEq,
|
||||
{
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.0 == other.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<Tz: TimeZone> PartialOrd for FmtDateTime<Tz>
|
||||
where
|
||||
DateTime<Tz>: PartialOrd,
|
||||
{
|
||||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl<Tz: TimeZone> Ord for FmtDateTime<Tz>
|
||||
where
|
||||
DateTime<Tz>: Ord,
|
||||
{
|
||||
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
|
||||
self.0.cmp(&other.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<FmtDateTime<Utc>> for FmtDateTime<Local> {
|
||||
fn from(dt: FmtDateTime<Utc>) -> Self {
|
||||
FmtDateTime(dt.0.with_timezone(&Local))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<FmtDateTime<Local>> for FmtDateTime<Utc> {
|
||||
fn from(dt: FmtDateTime<Local>) -> Self {
|
||||
FmtDateTime(dt.0.with_timezone(&Utc))
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub trait IntoDateTime {
|
||||
fn into_utc(self) -> FmtDateTime<Utc>;
|
||||
fn into_local(self) -> FmtDateTime<Local>;
|
||||
}
|
||||
|
||||
impl IntoDateTime for FmtDateTime<Local> {
|
||||
fn into_utc(self) -> FmtDateTime<Utc> {
|
||||
FmtDateTime(self.0.with_timezone(&Utc))
|
||||
}
|
||||
fn into_local(self) -> FmtDateTime<Local> {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoDateTime for FmtDateTime<Utc> {
|
||||
fn into_local(self) -> FmtDateTime<Local> {
|
||||
FmtDateTime(self.0.with_timezone(&Local))
|
||||
}
|
||||
fn into_utc(self) -> FmtDateTime<Utc> {
|
||||
self
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
use detect_desktop_environment::DesktopEnvironment;
|
||||
use serde::{Serialize, Serializer};
|
||||
use std::{
|
||||
fmt::{Debug, Display, Formatter, Result as FmtResult},
|
||||
ops::Deref,
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
pub struct SerdeDE(pub DesktopEnvironment);
|
||||
|
||||
impl Serialize for SerdeDE {
|
||||
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
serializer.serialize_str(&format!("{:?}", self.0))
|
||||
}
|
||||
}
|
||||
|
||||
impl SerdeDE {
|
||||
pub fn detect() -> Option<Self> {
|
||||
DesktopEnvironment::detect().map(SerdeDE)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||
pub struct FmtDE(pub SerdeDE);
|
||||
|
||||
impl FmtDE {
|
||||
pub fn detect() -> Option<Self> {
|
||||
SerdeDE::detect().map(FmtDE)
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for FmtDE {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
write!(f, "{:?}", self.0.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for FmtDE {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
Display::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for FmtDE {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
serializer.serialize_str(&self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for FmtDE {
|
||||
type Target = SerdeDE;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
7
subcrates/telemetry/src/modules/formatted/mod.rs
Normal file
7
subcrates/telemetry/src/modules/formatted/mod.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
pub mod architecture;
|
||||
pub mod bytes;
|
||||
pub mod date_time;
|
||||
pub mod desktop_environment;
|
||||
pub mod offset_time;
|
||||
pub mod relative_time;
|
||||
pub mod version;
|
68
subcrates/telemetry/src/modules/formatted/offset_time.rs
Normal file
68
subcrates/telemetry/src/modules/formatted/offset_time.rs
Normal file
|
@ -0,0 +1,68 @@
|
|||
use chrono::{DateTime, Local, Offset};
|
||||
use serde::Serialize;
|
||||
use std::{
|
||||
cmp::Ordering,
|
||||
fmt::{Debug, Display, Formatter, Result as FmtResult},
|
||||
ops::Deref,
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct FmtOffsetTime(pub DateTime<Local>);
|
||||
|
||||
impl Display for FmtOffsetTime {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
write!(f, "UTC{}", self.0.offset())
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for FmtOffsetTime {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
Display::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for FmtOffsetTime {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
serializer.serialize_str(&self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for FmtOffsetTime {
|
||||
type Target = DateTime<Local>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for FmtOffsetTime {}
|
||||
impl PartialEq for FmtOffsetTime {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.0.offset().fix() == other.0.offset().fix()
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialOrd for FmtOffsetTime {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(
|
||||
self.0
|
||||
.offset()
|
||||
.fix()
|
||||
.local_minus_utc()
|
||||
.cmp(&other.0.offset().fix().local_minus_utc()),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for FmtOffsetTime {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
self.0
|
||||
.offset()
|
||||
.fix()
|
||||
.local_minus_utc()
|
||||
.cmp(&other.0.offset().fix().local_minus_utc())
|
||||
}
|
||||
}
|
40
subcrates/telemetry/src/modules/formatted/relative_time.rs
Normal file
40
subcrates/telemetry/src/modules/formatted/relative_time.rs
Normal file
|
@ -0,0 +1,40 @@
|
|||
use serde::Serialize;
|
||||
use std::{
|
||||
fmt::{Debug, Display, Formatter, Result as FmtResult},
|
||||
ops::Deref,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct FmtRelativeTime(pub Duration);
|
||||
|
||||
impl Display for FmtRelativeTime {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
let formatter = timeago::Formatter::new();
|
||||
|
||||
write!(f, "{}", formatter.convert(self.0))
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for FmtRelativeTime {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
Display::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for FmtRelativeTime {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
serializer.serialize_str(&self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for FmtRelativeTime {
|
||||
type Target = Duration;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
38
subcrates/telemetry/src/modules/formatted/version.rs
Normal file
38
subcrates/telemetry/src/modules/formatted/version.rs
Normal file
|
@ -0,0 +1,38 @@
|
|||
use serde::Serialize;
|
||||
use std::{
|
||||
fmt::{Debug, Display, Formatter, Result as FmtResult},
|
||||
ops::Deref,
|
||||
};
|
||||
use versions::Versioning;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct FmtVersion(pub Versioning);
|
||||
|
||||
impl Display for FmtVersion {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
write!(f, "{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Debug for FmtVersion {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
Display::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for FmtVersion {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
serializer.serialize_str(&self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for FmtVersion {
|
||||
type Target = Versioning;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
}
|
||||
}
|
131
subcrates/telemetry/src/modules/gpu/mod.rs
Normal file
131
subcrates/telemetry/src/modules/gpu/mod.rs
Normal file
|
@ -0,0 +1,131 @@
|
|||
use super::Defaults::Unknown;
|
||||
use serde::Serialize;
|
||||
use serde_json::{Value, json};
|
||||
use wgpu;
|
||||
use winit::{
|
||||
application::ApplicationHandler,
|
||||
event::WindowEvent,
|
||||
event_loop::{ActiveEventLoop, EventLoop},
|
||||
window::WindowId,
|
||||
};
|
||||
|
||||
mod vram;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct DriverInfo {
|
||||
version: String,
|
||||
name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct AdapterInfo {
|
||||
vendor: String,
|
||||
model: String,
|
||||
driver: DriverInfo,
|
||||
vram: String,
|
||||
display: DisplayInfo,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct GPUInfo {
|
||||
supported_backends: Vec<String>,
|
||||
gpus: Vec<AdapterInfo>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Default)]
|
||||
pub struct DisplayInfo {
|
||||
resolution: String,
|
||||
refresh_rate: String,
|
||||
}
|
||||
|
||||
impl ApplicationHandler for DisplayInfo {
|
||||
fn resumed(&mut self, event_loop: &ActiveEventLoop) {
|
||||
if let Some(monitor) = event_loop.primary_monitor() {
|
||||
let size = monitor.size();
|
||||
let refresh_rate = monitor.refresh_rate_millihertz();
|
||||
|
||||
self.resolution = format!("{}x{}", size.width, size.height);
|
||||
self.refresh_rate = if let Some(refresh) = refresh_rate {
|
||||
format!("{} hz", refresh / 1000)
|
||||
} else {
|
||||
Unknown.into()
|
||||
}
|
||||
} else {
|
||||
self.resolution = Unknown.into();
|
||||
self.refresh_rate = Unknown.into();
|
||||
}
|
||||
|
||||
event_loop.exit();
|
||||
}
|
||||
|
||||
fn window_event(
|
||||
&mut self,
|
||||
_event_loop: &ActiveEventLoop,
|
||||
_window_id: WindowId,
|
||||
_event: WindowEvent,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
fn vendor_name(vendor: u32) -> &'static str {
|
||||
match vendor {
|
||||
0x10DE => "NVIDIA",
|
||||
0x1002 => "AMD(Advanced Micro Devices), Inc.",
|
||||
0x8086 => "Intel(integrated electronics)",
|
||||
0x13B5 => "ARM(Advanced RISC Machines)",
|
||||
0x5143 => "Qualcomm(Quality Communications)",
|
||||
0x1010 => "Apple Inc.",
|
||||
_ => "Unknown",
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_struct() -> GPUInfo {
|
||||
let mut gpu_data: Vec<AdapterInfo> = Vec::new();
|
||||
let mut backends: Vec<String> = Vec::new();
|
||||
let instance_descriptor = wgpu::InstanceDescriptor {
|
||||
backends: wgpu::Backends::all(),
|
||||
flags: wgpu::InstanceFlags::empty(),
|
||||
backend_options: Default::default(),
|
||||
};
|
||||
let instance = wgpu::Instance::new(&instance_descriptor);
|
||||
let event_loop = EventLoop::new().unwrap();
|
||||
let mut app = DisplayInfo::default();
|
||||
|
||||
event_loop.run_app(&mut app).unwrap();
|
||||
|
||||
for adapter in instance.enumerate_adapters(wgpu::Backends::all()) {
|
||||
let info = adapter.get_info();
|
||||
|
||||
if !backends.contains(&info.backend.to_string()) {
|
||||
backends.push(info.backend.to_string());
|
||||
}
|
||||
if info.driver.is_empty() || info.driver_info.is_empty() {
|
||||
continue;
|
||||
}
|
||||
|
||||
gpu_data.push(AdapterInfo {
|
||||
vendor: vendor_name(info.vendor).to_string(),
|
||||
model: info.name,
|
||||
driver: DriverInfo {
|
||||
version: info.driver_info,
|
||||
name: info.driver,
|
||||
},
|
||||
vram: vram::get(info.vendor, info.device),
|
||||
display: DisplayInfo {
|
||||
resolution: app.resolution.to_string(),
|
||||
refresh_rate: app.refresh_rate.to_string(),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
GPUInfo {
|
||||
supported_backends: backends,
|
||||
gpus: gpu_data,
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_json() -> Value {
|
||||
json!(get_struct())
|
||||
}
|
67
subcrates/telemetry/src/modules/gpu/vram.rs
Normal file
67
subcrates/telemetry/src/modules/gpu/vram.rs
Normal file
|
@ -0,0 +1,67 @@
|
|||
use super::super::Defaults::Unknown;
|
||||
use ash::vk::{API_VERSION_1_2, ApplicationInfo, InstanceCreateInfo, MemoryHeapFlags};
|
||||
use humansize::{DECIMAL, make_format};
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
pub fn get_metal() -> u64 {
|
||||
0
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn get_metal() -> u64 {
|
||||
use metal::Device as MetalDevice;
|
||||
|
||||
let device = MetalDevice::system_default().expect("No Metal-compatible GPU found");
|
||||
device.recommended_max_working_set_size()
|
||||
}
|
||||
|
||||
pub fn get_vulkan(device_id: u32) -> u64 {
|
||||
let entry = unsafe { ash::Entry::load().unwrap() };
|
||||
let app_info = ApplicationInfo {
|
||||
p_application_name: std::ptr::null(),
|
||||
application_version: 0,
|
||||
p_engine_name: std::ptr::null(),
|
||||
engine_version: 0,
|
||||
api_version: API_VERSION_1_2,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let create_info = InstanceCreateInfo {
|
||||
p_application_info: &app_info,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let instance = unsafe { entry.create_instance(&create_info, None).unwrap() };
|
||||
|
||||
let physical_devices = unsafe { instance.enumerate_physical_devices().unwrap() };
|
||||
let mut total_vram = 0;
|
||||
|
||||
for device in physical_devices {
|
||||
let memory_properties = unsafe { instance.get_physical_device_memory_properties(device) };
|
||||
let device_properties = unsafe { instance.get_physical_device_properties(device) };
|
||||
|
||||
if device_id != device_properties.device_id {
|
||||
continue;
|
||||
}
|
||||
|
||||
for heap in memory_properties.memory_heaps {
|
||||
if heap.flags.contains(MemoryHeapFlags::DEVICE_LOCAL) {
|
||||
total_vram += heap.size;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
total_vram
|
||||
}
|
||||
|
||||
pub fn get(vendor: u32, device_id: u32) -> String {
|
||||
let formatter = make_format(DECIMAL);
|
||||
|
||||
match vendor {
|
||||
0x10DE | 0x1002 | 0x8086 | 0x5143 => formatter(get_vulkan(device_id)),
|
||||
0x1010 => formatter(get_metal()),
|
||||
_ => Unknown.into(),
|
||||
}
|
||||
}
|
11
subcrates/telemetry/src/modules/macros/custom_anyhow.rs
Normal file
11
subcrates/telemetry/src/modules/macros/custom_anyhow.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
#[macro_export]
|
||||
macro_rules! custom_anyhow {
|
||||
($fmt:literal $(, $arg:expr)* $(,)?) => {
|
||||
::anyhow::anyhow!(
|
||||
concat!($fmt, " (file: {}, line: {})"),
|
||||
$($arg,)*
|
||||
file!(),
|
||||
line!()
|
||||
)
|
||||
};
|
||||
}
|
1
subcrates/telemetry/src/modules/macros/mod.rs
Normal file
1
subcrates/telemetry/src/modules/macros/mod.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub mod custom_anyhow;
|
49
subcrates/telemetry/src/modules/memory.rs
Normal file
49
subcrates/telemetry/src/modules/memory.rs
Normal file
|
@ -0,0 +1,49 @@
|
|||
use crate::modules::FmtBytes;
|
||||
use serde::Serialize;
|
||||
use serde_json::{Value, json};
|
||||
use sysinfo::System;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct PhysicalInfo {
|
||||
total: FmtBytes,
|
||||
used: FmtBytes,
|
||||
free: FmtBytes,
|
||||
available: FmtBytes,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct VirtualInfo {
|
||||
total: FmtBytes,
|
||||
used: FmtBytes,
|
||||
free: FmtBytes,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct MemoryInfo {
|
||||
physical: PhysicalInfo,
|
||||
virtual_swap: VirtualInfo,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_struct() -> MemoryInfo {
|
||||
let system = System::new_all();
|
||||
|
||||
MemoryInfo {
|
||||
physical: PhysicalInfo {
|
||||
total: FmtBytes(system.total_memory()),
|
||||
used: FmtBytes(system.used_memory()),
|
||||
free: FmtBytes(system.free_memory()),
|
||||
available: FmtBytes(system.available_memory()),
|
||||
},
|
||||
virtual_swap: VirtualInfo {
|
||||
total: FmtBytes(system.total_swap()),
|
||||
used: FmtBytes(system.used_swap()),
|
||||
free: FmtBytes(system.free_swap()),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_json() -> Value {
|
||||
json!(get_struct())
|
||||
}
|
33
subcrates/telemetry/src/modules/meta.rs
Normal file
33
subcrates/telemetry/src/modules/meta.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
use crate::{custom_anyhow, modules::FmtVersion};
|
||||
use anyhow::Result;
|
||||
use serde::Serialize;
|
||||
use serde_json::{Value, json};
|
||||
use sys_locale::get_locale;
|
||||
use versions::Versioning;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/built.rs"));
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct MetaInfo {
|
||||
version: FmtVersion,
|
||||
commit_hash: String,
|
||||
locale: String,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_struct() -> Result<MetaInfo> {
|
||||
let locale = get_locale().unwrap_or_else(|| String::from("en-US"));
|
||||
let version = Versioning::new(env!("CARGO_PKG_VERSION"))
|
||||
.ok_or(custom_anyhow!("Invalid version").context("Invalid Semver version"))?;
|
||||
|
||||
Ok(MetaInfo {
|
||||
version: FmtVersion(version),
|
||||
commit_hash: GIT_COMMIT_HASH.to_string(),
|
||||
locale,
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_json() -> Result<Value> {
|
||||
Ok(json!(get_struct()?))
|
||||
}
|
42
subcrates/telemetry/src/modules/mod.rs
Normal file
42
subcrates/telemetry/src/modules/mod.rs
Normal file
|
@ -0,0 +1,42 @@
|
|||
use std::fmt::{Debug, Display, Formatter, Result as FmtResult};
|
||||
|
||||
pub mod cpu;
|
||||
pub mod devices;
|
||||
pub mod external;
|
||||
pub mod formatted;
|
||||
pub mod gpu;
|
||||
pub mod macros;
|
||||
pub mod memory;
|
||||
pub mod meta;
|
||||
pub mod network;
|
||||
pub mod os;
|
||||
pub mod storage;
|
||||
pub mod uptime;
|
||||
|
||||
#[allow(unused_imports)]
|
||||
pub use formatted::{
|
||||
architecture::FmtOSArchitecture,
|
||||
bytes::FmtBytes,
|
||||
date_time::{FmtDateTime, IntoDateTime},
|
||||
desktop_environment::FmtDE,
|
||||
offset_time::FmtOffsetTime,
|
||||
relative_time::FmtRelativeTime,
|
||||
version::FmtVersion,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Defaults {
|
||||
Unknown,
|
||||
}
|
||||
|
||||
impl Display for Defaults {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
write!(f, "{:?}", self)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Defaults> for String {
|
||||
fn from(value: Defaults) -> Self {
|
||||
value.to_string()
|
||||
}
|
||||
}
|
25
subcrates/telemetry/src/modules/network.rs
Normal file
25
subcrates/telemetry/src/modules/network.rs
Normal file
|
@ -0,0 +1,25 @@
|
|||
use serde::Serialize;
|
||||
use serde_json::{Value, json};
|
||||
use sysinfo::Networks;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct NetworkInfo {
|
||||
adapters: Vec<String>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_struct() -> NetworkInfo {
|
||||
let networks = Networks::new_with_refreshed_list();
|
||||
let mut adapters = Vec::new();
|
||||
|
||||
for (interface_name, _network_data) in &networks {
|
||||
adapters.push(interface_name.to_string());
|
||||
}
|
||||
|
||||
NetworkInfo { adapters }
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_json() -> Value {
|
||||
json!(get_struct())
|
||||
}
|
54
subcrates/telemetry/src/modules/os.rs
Normal file
54
subcrates/telemetry/src/modules/os.rs
Normal file
|
@ -0,0 +1,54 @@
|
|||
use super::Defaults::Unknown;
|
||||
use crate::{
|
||||
custom_anyhow,
|
||||
modules::{FmtDE, FmtOSArchitecture},
|
||||
};
|
||||
use anyhow::Result;
|
||||
use serde::Serialize;
|
||||
use serde_json::{Value, json};
|
||||
use sysinfo::System;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct OSInfo {
|
||||
name: String,
|
||||
edition: String,
|
||||
version: String,
|
||||
architecture: FmtOSArchitecture,
|
||||
kernel: Option<String>,
|
||||
desktop_environment: Option<FmtDE>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_struct() -> Result<OSInfo> {
|
||||
let architecture = if cfg!(target_pointer_width = "64") {
|
||||
Ok(FmtOSArchitecture::W64_BIT)
|
||||
} else if cfg!(target_pointer_width = "32") {
|
||||
Ok(FmtOSArchitecture::W32_BIT)
|
||||
} else {
|
||||
Err(custom_anyhow!("Unsupported pointer width").context("16 bit systems are not supported"))
|
||||
}?;
|
||||
let kernel = if cfg!(target_os = "linux") || cfg!(target_os = "macos") {
|
||||
Some(System::kernel_long_version())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let desktop_environment = if cfg!(target_os = "linux") {
|
||||
FmtDE::detect()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Ok(OSInfo {
|
||||
name: System::name().unwrap_or(Unknown.into()),
|
||||
edition: System::long_os_version().unwrap_or(Unknown.into()),
|
||||
version: System::os_version().unwrap_or(Unknown.into()),
|
||||
architecture,
|
||||
kernel,
|
||||
desktop_environment,
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_json() -> Result<Value> {
|
||||
Ok(json!(get_struct()?))
|
||||
}
|
46
subcrates/telemetry/src/modules/storage.rs
Normal file
46
subcrates/telemetry/src/modules/storage.rs
Normal file
|
@ -0,0 +1,46 @@
|
|||
use crate::{custom_anyhow, modules::FmtBytes};
|
||||
use anyhow::Result;
|
||||
use serde::Serialize;
|
||||
use serde_json::{Value, json};
|
||||
pub use sysinfo::DiskKind;
|
||||
use sysinfo::Disks;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct StorageInfo {
|
||||
name: String,
|
||||
mount_point: String,
|
||||
disk_kind: DiskKind,
|
||||
space_left: FmtBytes,
|
||||
total: FmtBytes,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_list() -> Result<Vec<StorageInfo>> {
|
||||
let disks = Disks::new_with_refreshed_list();
|
||||
let mut drive_data = Vec::new();
|
||||
|
||||
for disk in disks.list() {
|
||||
drive_data.push(StorageInfo {
|
||||
name: format!("{:?}", disk.name()).trim_matches('\"').to_string(),
|
||||
mount_point: format!("{:?}", disk.mount_point())
|
||||
.replace("\\", "")
|
||||
.trim_matches('\"')
|
||||
.to_string(),
|
||||
disk_kind: disk.kind(),
|
||||
space_left: FmtBytes(disk.available_space()),
|
||||
total: FmtBytes(disk.total_space()),
|
||||
});
|
||||
}
|
||||
|
||||
if drive_data.is_empty() {
|
||||
return Err(custom_anyhow!("No storage drives found")
|
||||
.context("Drive_data is empty, expected disks.list() to return non-zero at line 39"));
|
||||
}
|
||||
|
||||
Ok(drive_data)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_json() -> Result<Value> {
|
||||
Ok(json!(get_list()?))
|
||||
}
|
54
subcrates/telemetry/src/modules/uptime.rs
Normal file
54
subcrates/telemetry/src/modules/uptime.rs
Normal file
|
@ -0,0 +1,54 @@
|
|||
use crate::{
|
||||
custom_anyhow,
|
||||
modules::{FmtDateTime, FmtOffsetTime, FmtRelativeTime},
|
||||
};
|
||||
use anyhow::Result;
|
||||
use chrono::{DateTime, Local, Utc};
|
||||
use serde::Serialize;
|
||||
use serde_json::{Value, json};
|
||||
use std::time::Duration as StdDuration;
|
||||
use sysinfo::System;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
struct DateInfo {
|
||||
time_offset: FmtOffsetTime,
|
||||
local_date_time: FmtDateTime<Local>,
|
||||
utc_date_time: FmtDateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct UptimeInfo {
|
||||
boot: DateInfo,
|
||||
now: DateInfo,
|
||||
relative: FmtRelativeTime,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_struct() -> Result<UptimeInfo> {
|
||||
let boot_time_utc = DateTime::<Utc>::from_timestamp(System::boot_time() as i64, 0).ok_or(
|
||||
custom_anyhow!("Invalid, or out of range timestamp")
|
||||
.context("Invalid timestamp: check seconds < 8_220_000_000_000"),
|
||||
)?;
|
||||
let boot_time_local: DateTime<Local> = boot_time_utc.with_timezone(&Local);
|
||||
let relative_time =
|
||||
StdDuration::from_secs((Local::now() - boot_time_local).num_seconds() as u64);
|
||||
|
||||
Ok(UptimeInfo {
|
||||
boot: DateInfo {
|
||||
time_offset: FmtOffsetTime(Local::now()),
|
||||
local_date_time: FmtDateTime(boot_time_local),
|
||||
utc_date_time: FmtDateTime(boot_time_utc),
|
||||
},
|
||||
now: DateInfo {
|
||||
time_offset: FmtOffsetTime(Local::now()),
|
||||
local_date_time: FmtDateTime(Local::now()),
|
||||
utc_date_time: FmtDateTime(Utc::now()),
|
||||
},
|
||||
relative: FmtRelativeTime(relative_time),
|
||||
})
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn get_json() -> Result<Value> {
|
||||
Ok(json!(get_struct()?))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue
Why is this even being changed?