mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 10:14:06 +02:00
some error cleanup
This commit is contained in:
parent
68416d6025
commit
8d6ef8e2fb
15 changed files with 311 additions and 189 deletions
165
Cargo.lock
generated
165
Cargo.lock
generated
|
|
@ -84,11 +84,28 @@ dependencies = [
|
||||||
"syn_util 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syn_util 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bytecount"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
version = "1.3.2"
|
version = "1.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cargo_metadata"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.45"
|
version = "1.0.45"
|
||||||
|
|
@ -182,21 +199,41 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "err-derive"
|
name = "err-derive"
|
||||||
version = "0.1.6"
|
version = "0.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://gitlab.com/torkleyy/err-derive.git#00f5fc2a1cf5c2340a7d8e49cbe7f7c12b911972"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"skeptic 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "error-chain"
|
||||||
|
version = "0.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"backtrace 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fs_extra"
|
name = "fs_extra"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fuchsia-cprng"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "glob"
|
||||||
|
version = "0.2.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "0.4.4"
|
version = "0.4.4"
|
||||||
|
|
@ -357,6 +394,14 @@ dependencies = [
|
||||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pulldown-cmark"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "0.3.15"
|
version = "0.3.15"
|
||||||
|
|
@ -378,6 +423,39 @@ dependencies = [
|
||||||
"proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.4.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rdrand"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.1.56"
|
version = "0.1.56"
|
||||||
|
|
@ -399,6 +477,14 @@ name = "regex-syntax"
|
||||||
version = "0.6.12"
|
version = "0.6.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "remove_dir_all"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-demangle"
|
name = "rustc-demangle"
|
||||||
version = "0.1.16"
|
version = "0.1.16"
|
||||||
|
|
@ -417,6 +503,14 @@ name = "ryu"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "same-file"
|
||||||
|
version = "1.0.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "scopeguard"
|
name = "scopeguard"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
|
@ -428,6 +522,7 @@ version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -473,6 +568,21 @@ dependencies = [
|
||||||
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "skeptic"
|
||||||
|
version = "0.13.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"pulldown-cmark 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "0.6.10"
|
version = "0.6.10"
|
||||||
|
|
@ -546,6 +656,15 @@ dependencies = [
|
||||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tempdir"
|
||||||
|
version = "0.3.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "termios"
|
name = "termios"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
|
|
@ -563,7 +682,7 @@ dependencies = [
|
||||||
"enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"enumflags2 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"enumflags2 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"enumflags2_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"enumflags2_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"err-derive 0.1.6 (git+https://gitlab.com/torkleyy/err-derive.git)",
|
||||||
"jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"main_error 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"main_error 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
@ -603,6 +722,21 @@ name = "unicode-xid"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version_check"
|
||||||
|
version = "0.1.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "walkdir"
|
||||||
|
version = "2.2.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.3.8"
|
version = "0.3.8"
|
||||||
|
|
@ -617,6 +751,14 @@ name = "winapi-i686-pc-windows-gnu"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winapi-util"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi-x86_64-pc-windows-gnu"
|
name = "winapi-x86_64-pc-windows-gnu"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
|
@ -633,7 +775,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a606a02debe2813760609f57a64a2ffd27d9fdf5b2f133eaca0b248dd92cdd2"
|
"checksum bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a606a02debe2813760609f57a64a2ffd27d9fdf5b2f133eaca0b248dd92cdd2"
|
||||||
"checksum bitstream_reader 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ddd36b9f93bc10fb8c9ca3dc7bfd3212cc197244dcada7efd250fc3d7834c0"
|
"checksum bitstream_reader 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ddd36b9f93bc10fb8c9ca3dc7bfd3212cc197244dcada7efd250fc3d7834c0"
|
||||||
"checksum bitstream_reader_derive 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "14e4573210a0cc968772847e1db9705e546f60cc1525c5cbfbf470dfa1fa391c"
|
"checksum bitstream_reader_derive 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "14e4573210a0cc968772847e1db9705e546f60cc1525c5cbfbf470dfa1fa391c"
|
||||||
|
"checksum bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b92204551573580e078dc80017f36a213eb77a0450e4ddd8cfa0f3f2d1f0178f"
|
||||||
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
|
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
|
||||||
|
"checksum cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1b4d380e1bab994591a24c2bdd1b054f64b60bef483a8c598c7c345bc3bbe"
|
||||||
"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be"
|
"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be"
|
||||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||||
"checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e"
|
"checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e"
|
||||||
|
|
@ -645,8 +789,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b90e520ec62c1864c8c78d637acbfe8baf5f63240f2fb8165b8325c07812dd"
|
"checksum enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b90e520ec62c1864c8c78d637acbfe8baf5f63240f2fb8165b8325c07812dd"
|
||||||
"checksum enumflags2 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8c30a444d141611c4826a1a2e7eba9a494458edf14754945fa37c9c20f6f7563"
|
"checksum enumflags2 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8c30a444d141611c4826a1a2e7eba9a494458edf14754945fa37c9c20f6f7563"
|
||||||
"checksum enumflags2_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9e015b3dfedc096cb55cdc5d022d6b4e6b94547212fb94ad2d9ece20bcd88fe3"
|
"checksum enumflags2_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9e015b3dfedc096cb55cdc5d022d6b4e6b94547212fb94ad2d9ece20bcd88fe3"
|
||||||
"checksum err-derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b41487fadaa500d02a819eefcde5f713599a01dd51626ef25d2d72d87115667b"
|
"checksum err-derive 0.1.6 (git+https://gitlab.com/torkleyy/err-derive.git)" = "<none>"
|
||||||
|
"checksum error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ab49e9dcb602294bc42f9a7dfc9bc6e936fca4418ea300dbfb84fe16de0b7d9"
|
||||||
"checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674"
|
"checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674"
|
||||||
|
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
||||||
|
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
|
||||||
"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
|
"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
|
||||||
"checksum jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45"
|
"checksum jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45"
|
||||||
"checksum jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69"
|
"checksum jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69"
|
||||||
|
|
@ -666,15 +813,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097"
|
"checksum proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097"
|
||||||
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||||
"checksum proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90cf5f418035b98e655e9cdb225047638296b862b42411c4e45bb88d700f7fc0"
|
"checksum proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90cf5f418035b98e655e9cdb225047638296b862b42411c4e45bb88d700f7fc0"
|
||||||
|
"checksum pulldown-cmark 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eef52fac62d0ea7b9b4dc7da092aa64ea7ec3d90af6679422d3d7e0e14b6ee15"
|
||||||
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
||||||
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
|
||||||
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
|
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
|
||||||
|
"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
|
||||||
|
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
||||||
|
"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||||
|
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
||||||
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
|
||||||
"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd"
|
"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd"
|
||||||
"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
|
"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
|
||||||
|
"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
|
||||||
"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
|
"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
|
||||||
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||||
"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997"
|
"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997"
|
||||||
|
"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421"
|
||||||
"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d"
|
"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d"
|
||||||
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||||
|
|
@ -682,6 +836,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e"
|
"checksum serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e"
|
||||||
"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2"
|
"checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2"
|
||||||
"checksum serde_repr 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "cd02c7587ec314570041b2754829f84d873ced14a96d1fd1823531e11db40573"
|
"checksum serde_repr 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "cd02c7587ec314570041b2754829f84d873ced14a96d1fd1823531e11db40573"
|
||||||
|
"checksum skeptic 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fb8ed853fdc19ce09752d63f3a2e5b5158aeb261520cd75eb618bd60305165"
|
||||||
"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
|
"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
|
||||||
"checksum snap 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "95d697d63d44ad8b78b8d235bf85b34022a78af292c8918527c5f0cffdde7f43"
|
"checksum snap 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "95d697d63d44ad8b78b8d235bf85b34022a78af292c8918527c5f0cffdde7f43"
|
||||||
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
||||||
|
|
@ -690,12 +845,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
"checksum syn_util 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50518d8ba51dbea1b0981d7bff56cecc2a20a02f22bf6fcf71a924bc241ee4a0"
|
"checksum syn_util 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50518d8ba51dbea1b0981d7bff56cecc2a20a02f22bf6fcf71a924bc241ee4a0"
|
||||||
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
|
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
|
||||||
"checksum synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203"
|
"checksum synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203"
|
||||||
|
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
|
||||||
"checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625"
|
"checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625"
|
||||||
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
||||||
"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20"
|
"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20"
|
||||||
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
|
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
|
||||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||||
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||||
|
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
|
||||||
|
"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e"
|
||||||
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
||||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
|
"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9"
|
||||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ serde = { version = "1.0", features = ["derive", "rc"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde_repr = "0.1"
|
serde_repr = "0.1"
|
||||||
better-panic = "0.1"
|
better-panic = "0.1"
|
||||||
err-derive = "0.1"
|
err-derive = { version = "0.1", git = "https://gitlab.com/torkleyy/err-derive.git" }
|
||||||
parse-display = "0.1"
|
parse-display = "0.1"
|
||||||
jemallocator = "0.3"
|
jemallocator = "0.3"
|
||||||
main_error = "0.1.0"
|
main_error = "0.1.0"
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ pub fn generate_game_events(demo: Demo) -> TokenStream {
|
||||||
|
|
||||||
let imports = quote!(
|
let imports = quote!(
|
||||||
use super::gamevent::{FromGameEventValue, FromRawGameEvent, GameEventValue, RawGameEvent};
|
use super::gamevent::{FromGameEventValue, FromRawGameEvent, GameEventValue, RawGameEvent};
|
||||||
use crate::{GameEventError, MalformedDemoError, Result};
|
use crate::{GameEventError, Result};
|
||||||
);
|
);
|
||||||
|
|
||||||
let event_definitions = events.iter().map(|event| {
|
let event_definitions = events.iter().map(|event| {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use super::gamevent::{FromGameEventValue, FromRawGameEvent, GameEventValue, RawGameEvent};
|
use super::gamevent::{FromGameEventValue, FromRawGameEvent, GameEventValue, RawGameEvent};
|
||||||
use crate::{GameEventError, MalformedDemoError, Result};
|
use crate::{GameEventError, Result};
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ServerSpawnEvent {
|
pub struct ServerSpawnEvent {
|
||||||
pub hostname: String,
|
pub hostname: String,
|
||||||
|
|
@ -7844,4 +7844,3 @@ impl GameEvent {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use bitstream_reader::BitRead;
|
use bitstream_reader::BitRead;
|
||||||
|
|
||||||
use crate::{MalformedDemoError, ParseError, Result};
|
use crate::{ParseError, Result};
|
||||||
|
|
||||||
pub use super::gameevent_gen::{GameEvent, GameEventType};
|
pub use super::gameevent_gen::{GameEvent, GameEventType};
|
||||||
use crate::demo::message::gameevent::GameEventTypeId;
|
use crate::demo::message::gameevent::GameEventTypeId;
|
||||||
|
|
@ -89,12 +89,11 @@ impl FromGameEventValue for String {
|
||||||
match value {
|
match value {
|
||||||
Some(GameEventValue::String(val)) => Ok(val),
|
Some(GameEventValue::String(val)) => Ok(val),
|
||||||
None => Ok(String::default()),
|
None => Ok(String::default()),
|
||||||
Some(value) => Err(MalformedDemoError::InvalidGameEvent {
|
Some(value) => Err(ParseError::InvalidGameEvent {
|
||||||
expected_type: GameEventValueType::String,
|
expected_type: GameEventValueType::String,
|
||||||
name,
|
name,
|
||||||
found_type: value.get_type(),
|
found_type: value.get_type(),
|
||||||
}
|
}),
|
||||||
.into()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -104,12 +103,11 @@ impl FromGameEventValue for f32 {
|
||||||
match value {
|
match value {
|
||||||
Some(GameEventValue::Float(val)) => Ok(val),
|
Some(GameEventValue::Float(val)) => Ok(val),
|
||||||
None => Ok(f32::default()),
|
None => Ok(f32::default()),
|
||||||
Some(value) => Err(MalformedDemoError::InvalidGameEvent {
|
Some(value) => Err(ParseError::InvalidGameEvent {
|
||||||
expected_type: GameEventValueType::Float,
|
expected_type: GameEventValueType::Float,
|
||||||
name,
|
name,
|
||||||
found_type: value.get_type(),
|
found_type: value.get_type(),
|
||||||
}
|
}),
|
||||||
.into()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -119,12 +117,11 @@ impl FromGameEventValue for u32 {
|
||||||
match value {
|
match value {
|
||||||
Some(GameEventValue::Long(val)) => Ok(val),
|
Some(GameEventValue::Long(val)) => Ok(val),
|
||||||
None => Ok(u32::default()),
|
None => Ok(u32::default()),
|
||||||
Some(value) => Err(MalformedDemoError::InvalidGameEvent {
|
Some(value) => Err(ParseError::InvalidGameEvent {
|
||||||
expected_type: GameEventValueType::Long,
|
expected_type: GameEventValueType::Long,
|
||||||
name,
|
name,
|
||||||
found_type: value.get_type(),
|
found_type: value.get_type(),
|
||||||
}
|
}),
|
||||||
.into()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -134,12 +131,11 @@ impl FromGameEventValue for u16 {
|
||||||
match value {
|
match value {
|
||||||
Some(GameEventValue::Short(val)) => Ok(val),
|
Some(GameEventValue::Short(val)) => Ok(val),
|
||||||
None => Ok(u16::default()),
|
None => Ok(u16::default()),
|
||||||
Some(value) => Err(MalformedDemoError::InvalidGameEvent {
|
Some(value) => Err(ParseError::InvalidGameEvent {
|
||||||
expected_type: GameEventValueType::Short,
|
expected_type: GameEventValueType::Short,
|
||||||
name,
|
name,
|
||||||
found_type: value.get_type(),
|
found_type: value.get_type(),
|
||||||
}
|
}),
|
||||||
.into()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -149,12 +145,11 @@ impl FromGameEventValue for u8 {
|
||||||
match value {
|
match value {
|
||||||
Some(GameEventValue::Byte(val)) => Ok(val),
|
Some(GameEventValue::Byte(val)) => Ok(val),
|
||||||
None => Ok(u8::default()),
|
None => Ok(u8::default()),
|
||||||
Some(value) => Err(MalformedDemoError::InvalidGameEvent {
|
Some(value) => Err(ParseError::InvalidGameEvent {
|
||||||
expected_type: GameEventValueType::Byte,
|
expected_type: GameEventValueType::Byte,
|
||||||
name,
|
name,
|
||||||
found_type: value.get_type(),
|
found_type: value.get_type(),
|
||||||
}
|
}),
|
||||||
.into()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -164,12 +159,11 @@ impl FromGameEventValue for bool {
|
||||||
match value {
|
match value {
|
||||||
Some(GameEventValue::Boolean(val)) => Ok(val),
|
Some(GameEventValue::Boolean(val)) => Ok(val),
|
||||||
None => Ok(bool::default()),
|
None => Ok(bool::default()),
|
||||||
Some(value) => Err(MalformedDemoError::InvalidGameEvent {
|
Some(value) => Err(ParseError::InvalidGameEvent {
|
||||||
expected_type: GameEventValueType::Boolean,
|
expected_type: GameEventValueType::Boolean,
|
||||||
name,
|
name,
|
||||||
found_type: value.get_type(),
|
found_type: value.get_type(),
|
||||||
}
|
}),
|
||||||
.into()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -178,12 +172,11 @@ impl FromGameEventValue for () {
|
||||||
fn from_value(value: Option<GameEventValue>, name: &'static str) -> Result<Self> {
|
fn from_value(value: Option<GameEventValue>, name: &'static str) -> Result<Self> {
|
||||||
match value {
|
match value {
|
||||||
Some(GameEventValue::Local) | None => Ok(()),
|
Some(GameEventValue::Local) | None => Ok(()),
|
||||||
Some(value) => Err(MalformedDemoError::InvalidGameEvent {
|
Some(value) => Err(ParseError::InvalidGameEvent {
|
||||||
expected_type: GameEventValueType::Local,
|
expected_type: GameEventValueType::Local,
|
||||||
name,
|
name,
|
||||||
found_type: value.get_type(),
|
found_type: value.get_type(),
|
||||||
}
|
}),
|
||||||
.into()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,7 @@ use crate::demo::gamevent::{
|
||||||
RawGameEvent,
|
RawGameEvent,
|
||||||
};
|
};
|
||||||
use crate::demo::parser::ParseBitSkip;
|
use crate::demo::parser::ParseBitSkip;
|
||||||
use crate::{
|
use crate::{GameEventError, Parse, ParseError, ParserState, ReadResult, Result, Stream};
|
||||||
GameEventError, MalformedDemoError, Parse, ParseError, ParserState, ReadResult, Result, Stream,
|
|
||||||
};
|
|
||||||
|
|
||||||
fn read_event_value(stream: &mut Stream, definition: &GameEventEntry) -> Result<GameEventValue> {
|
fn read_event_value(stream: &mut Stream, definition: &GameEventEntry) -> Result<GameEventValue> {
|
||||||
Ok(match definition.kind {
|
Ok(match definition.kind {
|
||||||
|
|
@ -48,11 +46,7 @@ impl Parse for GameEventMessage {
|
||||||
values,
|
values,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => return Err(ParseError::MalformedGameEvent(GameEventError::UnknownType)),
|
||||||
return Err(
|
|
||||||
MalformedDemoError::MalformedGameEvent(GameEventError::UnknownType).into(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
let event = GameEvent::from_raw_event(raw_event)?;
|
let event = GameEvent::from_raw_event(raw_event)?;
|
||||||
Ok(GameEventMessage { event })
|
Ok(GameEventMessage { event })
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use crate::demo::message::tempentities::*;
|
||||||
use crate::demo::message::usermessage::*;
|
use crate::demo::message::usermessage::*;
|
||||||
use crate::demo::message::voice::*;
|
use crate::demo::message::voice::*;
|
||||||
use crate::demo::parser::ParseBitSkip;
|
use crate::demo::parser::ParseBitSkip;
|
||||||
use crate::{MalformedDemoError, Parse, ParseError, ParserState, Result, Stream};
|
use crate::{Parse, ParseError, ParserState, Result, Stream};
|
||||||
|
|
||||||
pub mod bspdecal;
|
pub mod bspdecal;
|
||||||
pub mod classinfo;
|
pub mod classinfo;
|
||||||
|
|
@ -65,7 +65,7 @@ impl Parse for MessageType {
|
||||||
fn parse(stream: &mut Stream, _state: &ParserState) -> Result<Self> {
|
fn parse(stream: &mut Stream, _state: &ParserState) -> Result<Self> {
|
||||||
let raw = stream.read_int(6)?;
|
let raw = stream.read_int(6)?;
|
||||||
let prop_type: Option<MessageType> = MessageType::from_u8(raw);
|
let prop_type: Option<MessageType> = MessageType::from_u8(raw);
|
||||||
prop_type.ok_or(MalformedDemoError::InvalidMessageType(raw).into())
|
prop_type.ok_or(ParseError::InvalidMessageType(raw))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use crate::demo::message::stringtable::{log_base2, read_var_int};
|
||||||
use crate::demo::packet::datatable::{ClassId, SendTable, SendTableName, ServerClass};
|
use crate::demo::packet::datatable::{ClassId, SendTable, SendTableName, ServerClass};
|
||||||
use crate::demo::parser::ParseBitSkip;
|
use crate::demo::parser::ParseBitSkip;
|
||||||
use crate::demo::sendprop::{SendProp, SendPropDefinition, SendPropValue};
|
use crate::demo::sendprop::{SendProp, SendPropDefinition, SendPropValue};
|
||||||
use crate::{MalformedDemoError, Parse, ParseError, ParserState, ReadResult, Result, Stream};
|
use crate::{Parse, ParseError, ParserState, ReadResult, Result, Stream};
|
||||||
use parse_display::{Display, FromStr};
|
use parse_display::{Display, FromStr};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
@ -111,7 +111,7 @@ fn get_send_table(state: &ParserState, class: ClassId) -> Result<&SendTable> {
|
||||||
state
|
state
|
||||||
.send_tables
|
.send_tables
|
||||||
.get(usize::from(class))
|
.get(usize::from(class))
|
||||||
.ok_or_else(|| MalformedDemoError::UnknownServerClass(class).into())
|
.ok_or_else(|| ParseError::UnknownServerClass(class))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_entity_for_update(
|
fn get_entity_for_update(
|
||||||
|
|
@ -122,7 +122,7 @@ fn get_entity_for_update(
|
||||||
let class_id = *state
|
let class_id = *state
|
||||||
.entity_classes
|
.entity_classes
|
||||||
.get(&entity_index)
|
.get(&entity_index)
|
||||||
.ok_or_else(|| MalformedDemoError::UnknownEntity(entity_index))?;
|
.ok_or_else(|| ParseError::UnknownEntity(entity_index))?;
|
||||||
|
|
||||||
Ok(PacketEntity {
|
Ok(PacketEntity {
|
||||||
server_class: class_id,
|
server_class: class_id,
|
||||||
|
|
@ -207,7 +207,7 @@ impl PacketEntitiesMessage {
|
||||||
let send_table = state
|
let send_table = state
|
||||||
.send_tables
|
.send_tables
|
||||||
.get(usize::from(class_index))
|
.get(usize::from(class_index))
|
||||||
.ok_or_else(|| MalformedDemoError::UnknownServerClass(class_index))?;
|
.ok_or_else(|| ParseError::UnknownServerClass(class_index))?;
|
||||||
|
|
||||||
let props = match state.instance_baselines[baseline_index].get(&entity_index) {
|
let props = match state.instance_baselines[baseline_index].get(&entity_index) {
|
||||||
Some(baseline) => baseline.clone(),
|
Some(baseline) => baseline.clone(),
|
||||||
|
|
@ -250,7 +250,7 @@ impl PacketEntitiesMessage {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
return Err(ParseError::from(MalformedDemoError::PropIndexOutOfBounds {
|
return Err(ParseError::from(ParseError::PropIndexOutOfBounds {
|
||||||
index,
|
index,
|
||||||
prop_count: send_table.flattened_props.len(),
|
prop_count: send_table.flattened_props.len(),
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use crate::demo::packet::stringtable::{
|
||||||
ExtraData, FixedUserDataSize, StringTable, StringTableEntry,
|
ExtraData, FixedUserDataSize, StringTable, StringTableEntry,
|
||||||
};
|
};
|
||||||
use crate::demo::parser::ParseBitSkip;
|
use crate::demo::parser::ParseBitSkip;
|
||||||
use crate::{MalformedDemoError, Parse, ParseError, ParserState, ReadResult, Result, Stream};
|
use crate::{Parse, ParseError, ParserState, ReadResult, Result, Stream};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct CreateStringTableMessage {
|
pub struct CreateStringTableMessage {
|
||||||
|
|
@ -122,7 +122,7 @@ impl Parse for UpdateStringTableMessage {
|
||||||
|
|
||||||
let entries = match state.string_tables.get(table_id as usize) {
|
let entries = match state.string_tables.get(table_id as usize) {
|
||||||
Some(table) => parse_string_table_update(&mut data, table, changed),
|
Some(table) => parse_string_table_update(&mut data, table, changed),
|
||||||
None => return Err(MalformedDemoError::StringTableNotFound(table_id).into()),
|
None => return Err(ParseError::StringTableNotFound(table_id).into()),
|
||||||
}?;
|
}?;
|
||||||
|
|
||||||
Ok(UpdateStringTableMessage { table_id, entries })
|
Ok(UpdateStringTableMessage { table_id, entries })
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use crate::demo::parser::MalformedSendPropDefinitionError;
|
||||||
use crate::demo::sendprop::{
|
use crate::demo::sendprop::{
|
||||||
SendPropDefinition, SendPropDefinitionIndex, SendPropFlag, SendPropName, SendPropType,
|
SendPropDefinition, SendPropDefinitionIndex, SendPropFlag, SendPropName, SendPropType,
|
||||||
};
|
};
|
||||||
use crate::{MalformedDemoError, Parse, ParseError, ParserState, ReadResult, Result, Stream};
|
use crate::{Parse, ParseError, ParserState, ReadResult, Result, Stream};
|
||||||
use parse_display::{Display, FromStr};
|
use parse_display::{Display, FromStr};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
|
|
@ -220,7 +220,7 @@ impl Parse for DataTablePacket {
|
||||||
let server_classes = packet_data.read_sized(server_class_count)?;
|
let server_classes = packet_data.read_sized(server_class_count)?;
|
||||||
|
|
||||||
if packet_data.bits_left() > 7 {
|
if packet_data.bits_left() > 7 {
|
||||||
Err(MalformedDemoError::DataRemaining(packet_data.bits_left()).into())
|
Err(ParseError::DataRemaining(packet_data.bits_left()))
|
||||||
} else {
|
} else {
|
||||||
Ok(DataTablePacket {
|
Ok(DataTablePacket {
|
||||||
tick,
|
tick,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use std::fmt;
|
||||||
use bitstream_reader::{BitRead, LittleEndian};
|
use bitstream_reader::{BitRead, LittleEndian};
|
||||||
|
|
||||||
use crate::demo::message::stringtable::StringTableMeta;
|
use crate::demo::message::stringtable::StringTableMeta;
|
||||||
use crate::{MalformedDemoError, Parse, ParseError, ParserState, ReadResult, Result, Stream};
|
use crate::{Parse, ParseError, ParserState, ReadResult, Result, Stream};
|
||||||
|
|
||||||
#[derive(BitRead, Clone, Copy, Debug)]
|
#[derive(BitRead, Clone, Copy, Debug)]
|
||||||
pub struct FixedUserDataSize {
|
pub struct FixedUserDataSize {
|
||||||
|
|
@ -125,7 +125,7 @@ impl Parse for StringTablePacket {
|
||||||
let tables = packet_data.read_sized(count)?;
|
let tables = packet_data.read_sized(count)?;
|
||||||
|
|
||||||
if packet_data.bits_left() > 7 {
|
if packet_data.bits_left() > 7 {
|
||||||
Err(MalformedDemoError::DataRemaining(packet_data.bits_left()).into())
|
Err(ParseError::DataRemaining(packet_data.bits_left()))
|
||||||
} else {
|
} else {
|
||||||
Ok(StringTablePacket { tick, tables })
|
Ok(StringTablePacket { tick, tables })
|
||||||
}
|
}
|
||||||
|
|
|
||||||
111
src/demo/parser/error.rs
Normal file
111
src/demo/parser/error.rs
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
use crate::demo::gamevent::GameEventValueType;
|
||||||
|
use crate::demo::message::packetentities::EntityId;
|
||||||
|
use crate::demo::packet::datatable::{ClassId, SendTableName};
|
||||||
|
use bitstream_reader::{FromUtf8Error, ReadError};
|
||||||
|
use err_derive::Error;
|
||||||
|
|
||||||
|
/// Errors that can occur during parsing
|
||||||
|
#[derive(Debug, Error)]
|
||||||
|
pub enum ParseError {
|
||||||
|
#[error(display = "Error while reading bits from stream: {}", _0)]
|
||||||
|
ReadError(#[error(source, no_from)] ReadError),
|
||||||
|
#[error(display = "Malformed utf8 while reading string")]
|
||||||
|
MalformedUTF8(#[error(source)] FromUtf8Error),
|
||||||
|
#[error(display = "Unexpected type of compressed data: {}", _0)]
|
||||||
|
UnexpectedCompressionType(String),
|
||||||
|
#[error(
|
||||||
|
display = "Error while decompressing SNAP compressed string table: {}",
|
||||||
|
_0
|
||||||
|
)]
|
||||||
|
SnapError(#[error(source)] snap::Error),
|
||||||
|
#[error(
|
||||||
|
display = "Unexpected size after decompressing SNAP data, got {} bytes, expected {} bytes",
|
||||||
|
size,
|
||||||
|
expected
|
||||||
|
)]
|
||||||
|
UnexpectedDecompressedSize {
|
||||||
|
/// Expected decompressed size
|
||||||
|
expected: u32,
|
||||||
|
/// Actual decompressed size
|
||||||
|
size: u32,
|
||||||
|
},
|
||||||
|
#[error(display = "Malformed demo file: {}", _0)]
|
||||||
|
InvalidDemo(&'static str),
|
||||||
|
#[error(display = "Packet identifier is invalid: {}", _0)]
|
||||||
|
InvalidPacketType(u8),
|
||||||
|
#[error(display = "Message identifier is invalid: {}", _0)]
|
||||||
|
InvalidMessageType(u8),
|
||||||
|
#[error(display = "Invalid SendProp type: {}", _0)]
|
||||||
|
InvalidSendPropType(u8),
|
||||||
|
#[error(display = "Invalid SendProp: {}", _0)]
|
||||||
|
InvalidSendProp(#[error(source)] MalformedSendPropDefinitionError),
|
||||||
|
#[error(
|
||||||
|
display = "Unexpected amount of data left after parsing an object, {} bits remaining",
|
||||||
|
_0
|
||||||
|
)]
|
||||||
|
DataRemaining(usize),
|
||||||
|
#[error(display = "String table with index {} not found", _0)]
|
||||||
|
StringTableNotFound(u8),
|
||||||
|
#[error(display = "A malformed game event was read")]
|
||||||
|
MalformedGameEvent(#[error(source)] GameEventError),
|
||||||
|
#[error(
|
||||||
|
display = "A read game event doesn't contain the expected values, expected type {} for {} event, got type {}",
|
||||||
|
expected_type,
|
||||||
|
name,
|
||||||
|
found_type
|
||||||
|
)]
|
||||||
|
InvalidGameEvent {
|
||||||
|
expected_type: GameEventValueType,
|
||||||
|
name: &'static str,
|
||||||
|
found_type: GameEventValueType,
|
||||||
|
},
|
||||||
|
#[error(display = "An entity with an unknown server class({}) was read", _0)]
|
||||||
|
UnknownServerClass(ClassId),
|
||||||
|
#[error(display = "Unknown send table: {}", _0)]
|
||||||
|
UnknownSendTable(SendTableName),
|
||||||
|
#[error(
|
||||||
|
display = "Property index out of bounds, got {} but only {} props exist",
|
||||||
|
_0,
|
||||||
|
_1
|
||||||
|
)]
|
||||||
|
PropIndexOutOfBounds { index: i32, prop_count: usize },
|
||||||
|
#[error(display = "An attempt was made to update an unknown entity: {}", _0)]
|
||||||
|
UnknownEntity(EntityId),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Error)]
|
||||||
|
pub enum MalformedSendPropDefinitionError {
|
||||||
|
#[error(display = "Float property without defined size")]
|
||||||
|
UnsizedFloat,
|
||||||
|
#[error(display = "Array property without defined size")]
|
||||||
|
UnsizedArray,
|
||||||
|
#[error(display = "Array property without defined inner type")]
|
||||||
|
UntypedArray,
|
||||||
|
#[error(display = "Property used that can't be read")]
|
||||||
|
InvalidPropType,
|
||||||
|
#[error(display = "Array contents can't have the 'ChangesOften' flag")]
|
||||||
|
ArrayChangesOften,
|
||||||
|
#[error(display = "SendProp value out of range")]
|
||||||
|
OutOfRange,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Error)]
|
||||||
|
pub enum GameEventError {
|
||||||
|
#[error(display = "Incorrect number of values")]
|
||||||
|
IncorrectValueCount,
|
||||||
|
#[error(display = "Event with 'none' value")]
|
||||||
|
NoneValue,
|
||||||
|
#[error(display = "Unknown type")]
|
||||||
|
UnknownType,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<ReadError> for ParseError {
|
||||||
|
fn from(err: ReadError) -> ParseError {
|
||||||
|
match err {
|
||||||
|
ReadError::Utf8Error(utf8_error) => ParseError::MalformedUTF8(utf8_error),
|
||||||
|
_ => ParseError::ReadError(err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Result<T> = std::result::Result<T, ParseError>;
|
||||||
|
|
@ -14,146 +14,12 @@ use crate::Stream;
|
||||||
use err_derive::Error;
|
use err_derive::Error;
|
||||||
|
|
||||||
mod analyser;
|
mod analyser;
|
||||||
|
mod error;
|
||||||
mod handler;
|
mod handler;
|
||||||
mod messagetypeanalyser;
|
mod messagetypeanalyser;
|
||||||
mod state;
|
mod state;
|
||||||
|
|
||||||
/// Errors that can occur during parsing
|
pub use self::error::*;
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum ParseError {
|
|
||||||
#[error(display = "Error while reading bits from stream: {}", _0)]
|
|
||||||
ReadError(#[error(cause)] ReadError),
|
|
||||||
#[error(display = "Malformed utf8 while reading string")]
|
|
||||||
MalformedUTF8(#[error(cause)] FromUtf8Error),
|
|
||||||
#[error(display = "Malformed demo file: {}", _0)]
|
|
||||||
MalformedDemo(#[error(cause)] MalformedDemoError),
|
|
||||||
#[error(display = "Unexpected type of compressed data: {}", _0)]
|
|
||||||
UnexpectedCompressionType(String),
|
|
||||||
#[error(
|
|
||||||
display = "Error while decompressing SNAP compressed string table: {}",
|
|
||||||
_0
|
|
||||||
)]
|
|
||||||
SnapError(#[error(cause)] snap::Error),
|
|
||||||
#[error(
|
|
||||||
display = "Unexpected size after decompressing SNAP data, got {} bytes, expected {} bytes",
|
|
||||||
size,
|
|
||||||
expected
|
|
||||||
)]
|
|
||||||
UnexpectedDecompressedSize {
|
|
||||||
/// Expected decompressed size
|
|
||||||
expected: u32,
|
|
||||||
/// Actual decompressed size
|
|
||||||
size: u32,
|
|
||||||
},
|
|
||||||
#[error(display = "Malformed demo file: {}", _0)]
|
|
||||||
InvalidDemo(&'static str),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Malformed demo file
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum MalformedDemoError {
|
|
||||||
#[error(display = "Packet identifier is invalid: {}", _0)]
|
|
||||||
InvalidPacketType(u8),
|
|
||||||
#[error(display = "Message identifier is invalid: {}", _0)]
|
|
||||||
InvalidMessageType(u8),
|
|
||||||
#[error(display = "Invalid SendProp type: {}", _0)]
|
|
||||||
InvalidSendPropType(u8),
|
|
||||||
#[error(display = "Invalid SendProp: {}", _0)]
|
|
||||||
InvalidSendProp(MalformedSendPropDefinitionError),
|
|
||||||
#[error(
|
|
||||||
display = "Unexpected amount of data left after parsing an object, {} bits remaining",
|
|
||||||
_0
|
|
||||||
)]
|
|
||||||
DataRemaining(usize),
|
|
||||||
#[error(display = "String table with index {} not found", _0)]
|
|
||||||
StringTableNotFound(u8),
|
|
||||||
#[error(display = "A malformed game event was read")]
|
|
||||||
MalformedGameEvent(#[error(cause)] GameEventError),
|
|
||||||
#[error(
|
|
||||||
display = "A read game event doesn't contain the expected values, expected type {} for {} event, got type {}",
|
|
||||||
expected_type,
|
|
||||||
name,
|
|
||||||
found_type
|
|
||||||
)]
|
|
||||||
InvalidGameEvent {
|
|
||||||
expected_type: GameEventValueType,
|
|
||||||
name: &'static str,
|
|
||||||
found_type: GameEventValueType,
|
|
||||||
},
|
|
||||||
#[error(display = "An entity with an unknown server class({}) was read", _0)]
|
|
||||||
UnknownServerClass(ClassId),
|
|
||||||
#[error(display = "Unknown send table: {}", _0)]
|
|
||||||
UnknownSendTable(SendTableName),
|
|
||||||
#[error(
|
|
||||||
display = "Property index out of bounds, got {} but only {} props exist",
|
|
||||||
_0,
|
|
||||||
_1
|
|
||||||
)]
|
|
||||||
PropIndexOutOfBounds { index: i32, prop_count: usize },
|
|
||||||
#[error(display = "An attempt was made to update an unknown entity: {}", _0)]
|
|
||||||
UnknownEntity(EntityId),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum MalformedSendPropDefinitionError {
|
|
||||||
#[error(display = "Float property without defined size")]
|
|
||||||
UnsizedFloat,
|
|
||||||
#[error(display = "Array property without defined size")]
|
|
||||||
UnsizedArray,
|
|
||||||
#[error(display = "Array property without defined inner type")]
|
|
||||||
UntypedArray,
|
|
||||||
#[error(display = "Property used that can't be read")]
|
|
||||||
InvalidPropType,
|
|
||||||
#[error(display = "Array contents can't have the 'ChangesOften' flag")]
|
|
||||||
ArrayChangesOften,
|
|
||||||
#[error(display = "SendProp value out of range")]
|
|
||||||
OutOfRange,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum GameEventError {
|
|
||||||
#[error(display = "Incorrect number of values")]
|
|
||||||
IncorrectValueCount,
|
|
||||||
#[error(display = "Event with 'none' value")]
|
|
||||||
NoneValue,
|
|
||||||
#[error(display = "Unknown type")]
|
|
||||||
UnknownType,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<ReadError> for ParseError {
|
|
||||||
fn from(err: ReadError) -> ParseError {
|
|
||||||
match err {
|
|
||||||
ReadError::Utf8Error(utf8_error) => ParseError::MalformedUTF8(utf8_error),
|
|
||||||
_ => ParseError::ReadError(err),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<snap::Error> for ParseError {
|
|
||||||
fn from(err: snap::Error) -> ParseError {
|
|
||||||
ParseError::SnapError(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<MalformedDemoError> for ParseError {
|
|
||||||
fn from(err: MalformedDemoError) -> ParseError {
|
|
||||||
ParseError::MalformedDemo(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<MalformedSendPropDefinitionError> for ParseError {
|
|
||||||
fn from(err: MalformedSendPropDefinitionError) -> ParseError {
|
|
||||||
ParseError::MalformedDemo(MalformedDemoError::InvalidSendProp(err))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<GameEventError> for ParseError {
|
|
||||||
fn from(err: GameEventError) -> ParseError {
|
|
||||||
ParseError::MalformedDemo(MalformedDemoError::MalformedGameEvent(err))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub type Result<T> = std::result::Result<T, ParseError>;
|
|
||||||
|
|
||||||
pub trait Parse: Sized {
|
pub trait Parse: Sized {
|
||||||
fn parse(stream: &mut Stream, state: &ParserState) -> Result<Self>;
|
fn parse(stream: &mut Stream, state: &ParserState) -> Result<Self>;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ use enumflags2::BitFlags;
|
||||||
use enumflags2_derive::EnumFlags;
|
use enumflags2_derive::EnumFlags;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::{MalformedDemoError, Parse, ParseError, ReadResult, Result, Stream};
|
use crate::{Parse, ParseError, ReadResult, Result, Stream};
|
||||||
|
|
||||||
use super::packet::datatable::ParseSendTable;
|
use super::packet::datatable::ParseSendTable;
|
||||||
use super::vector::{Vector, VectorXY};
|
use super::vector::{Vector, VectorXY};
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ pub use bitstream_reader::Result as ReadResult;
|
||||||
pub use crate::demo::{
|
pub use crate::demo::{
|
||||||
message::MessageType,
|
message::MessageType,
|
||||||
parser::{
|
parser::{
|
||||||
DemoParser, GameEventError, MalformedDemoError, MatchState, MessageTypeAnalyser, Parse,
|
DemoParser, GameEventError, MatchState, MessageTypeAnalyser, Parse, ParseError,
|
||||||
ParseError, ParserState, Result,
|
ParserState, Result,
|
||||||
},
|
},
|
||||||
Demo, Stream,
|
Demo, Stream,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue