mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 10:14:06 +02:00
fmt+clippy
This commit is contained in:
parent
43c9021ba2
commit
2bad24dedd
30 changed files with 947 additions and 3396 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -39,7 +39,7 @@ jobs:
|
|||
with:
|
||||
name: ci
|
||||
instance: https://cache.icewind.me
|
||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||
authToken: "${{ secrets.ATTIC_TOKEN }}"
|
||||
- run: nix run .#demostf-parser-schema > schema.json
|
||||
- run: |
|
||||
git diff
|
||||
|
|
|
|||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
|
@ -40,4 +40,4 @@ jobs:
|
|||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: result/bin/parse_demo${{ matrix.binary-suffix }}
|
||||
asset_name: parser-${{ matrix.target }}${{ matrix.binary-suffix }}
|
||||
tag: ${{ github.ref }}
|
||||
tag: ${{ github.ref }}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ which will place the binary at `target/release/parse_demo`
|
|||
Basic usage is as simple as `parse_demo demofile.dem` which will output a "summary" of the demo file in JSON format.
|
||||
|
||||
Passing the `detailed_summary` argument to the end of `parse_demo` will output a table with scoreboard information for all players who were ever on the server while the demo
|
||||
was being recorded. The player who created the demo will be highlighted in the output.
|
||||
was being recorded. The player who created the demo will be highlighted in the output.
|
||||
|
||||
## Advanced usage
|
||||
|
||||
|
|
@ -67,4 +67,4 @@ Once you have a custom analyser you can use it with:
|
|||
```rust
|
||||
DemoParser::new_all_with_analyser(demo.get_stream(), CustomAnalyser::new());
|
||||
let (header, state) = parser.parse()?;
|
||||
```
|
||||
```
|
||||
|
|
|
|||
|
|
@ -29,6 +29,6 @@
|
|||
demostf-parser-schema = pkgs: pkgs.demostf-parser-schema;
|
||||
};
|
||||
|
||||
tools = pkgs: with pkgs; [cargo-insta];
|
||||
tools = pkgs: with pkgs; [bacon cargo-insta];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
4244
schema.json
4244
schema.json
File diff suppressed because it is too large
Load diff
|
|
@ -157,7 +157,7 @@ impl<'a> BitRead<'a, LittleEndian> for UserMessage<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> BitWrite<LittleEndian> for UserMessage<'a> {
|
||||
impl BitWrite<LittleEndian> for UserMessage<'_> {
|
||||
fn write(&self, stream: &mut BitWriteStream<LittleEndian>) -> ReadResult<()> {
|
||||
self.message_type().write(stream)?;
|
||||
stream.reserve_length(11, |stream| match self {
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ impl<'a> BitRead<'a, LittleEndian> for ParseSoundsMessage<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> BitWrite<LittleEndian> for ParseSoundsMessage<'a> {
|
||||
impl BitWrite<LittleEndian> for ParseSoundsMessage<'_> {
|
||||
fn write(&self, stream: &mut BitWriteStream<LittleEndian>) -> ReadResult<()> {
|
||||
self.reliable.write(stream)?;
|
||||
if !self.reliable {
|
||||
|
|
|
|||
|
|
@ -73,13 +73,13 @@ pub struct DemoHandler<'a, T: MessageHandler> {
|
|||
pub state_handler: ParserState,
|
||||
}
|
||||
|
||||
impl<'a> DemoHandler<'a, NullHandler> {
|
||||
impl DemoHandler<'_, NullHandler> {
|
||||
pub fn new() -> Self {
|
||||
Self::parse_all_with_analyser(NullHandler)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Default for DemoHandler<'a, NullHandler> {
|
||||
impl Default for DemoHandler<'_, NullHandler> {
|
||||
fn default() -> Self {
|
||||
DemoHandler::new()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,24 +63,24 @@ pub struct DemoParser<'a, A: MessageHandler> {
|
|||
}
|
||||
|
||||
impl<'a> DemoParser<'a, Analyser> {
|
||||
pub fn new(stream: Stream<'a>) -> DemoParser<Analyser> {
|
||||
pub fn new(stream: Stream<'a>) -> Self {
|
||||
DemoParser::new_with_analyser(stream, Analyser::new())
|
||||
}
|
||||
|
||||
pub fn new_all(stream: Stream<'a>) -> DemoParser<Analyser> {
|
||||
pub fn new_all(stream: Stream<'a>) -> Self {
|
||||
DemoParser::new_all_with_analyser(stream, Analyser::new())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, A: MessageHandler> DemoParser<'a, A> {
|
||||
pub fn new_with_analyser(stream: Stream<'a>, analyser: A) -> DemoParser<A> {
|
||||
pub fn new_with_analyser(stream: Stream<'a>, analyser: A) -> Self {
|
||||
DemoParser {
|
||||
handler: DemoHandler::with_analyser(analyser),
|
||||
stream,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_all_with_analyser(stream: Stream<'a>, analyser: A) -> DemoParser<A> {
|
||||
pub fn new_all_with_analyser(stream: Stream<'a>, analyser: A) -> Self {
|
||||
DemoParser {
|
||||
handler: DemoHandler::parse_all_with_analyser(analyser),
|
||||
stream,
|
||||
|
|
@ -158,7 +158,7 @@ pub struct DemoTicker<'a, A: MessageHandler> {
|
|||
packets: RawPacketStream<'a>,
|
||||
}
|
||||
|
||||
impl<'a, A: MessageHandler> DemoTicker<'a, A> {
|
||||
impl<A: MessageHandler> DemoTicker<'_, A> {
|
||||
/// Process the next packet
|
||||
///
|
||||
/// returns whether or not there are still packets left in the demo
|
||||
|
|
@ -179,7 +179,7 @@ impl<'a, A: MessageHandler> DemoTicker<'a, A> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, A: MessageHandler + BorrowMessageHandler> DemoTicker<'a, A> {
|
||||
impl<A: MessageHandler + BorrowMessageHandler> DemoTicker<'_, A> {
|
||||
pub fn state(&self) -> &A::Output {
|
||||
self.handler.borrow_output()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ impl StaticBaseline {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ParserState {
|
||||
impl ParserState {
|
||||
pub fn new(
|
||||
protocol_version: u32,
|
||||
analyser_handles: fn(message_type: MessageType) -> bool,
|
||||
|
|
@ -294,12 +294,7 @@ impl<'a> ParserState {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn handle_string_entry(
|
||||
&mut self,
|
||||
table: &str,
|
||||
_index: usize,
|
||||
entry: &StringTableEntry<'a>,
|
||||
) {
|
||||
pub fn handle_string_entry(&mut self, table: &str, _index: usize, entry: &StringTableEntry) {
|
||||
if table == "instancebaseline" {
|
||||
if let (Some(extra), Ok(class_id)) = (&entry.extra_data, entry.text().parse()) {
|
||||
let baseline = StaticBaseline::new(class_id, extra.data.to_owned());
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
"bits": 1
|
||||
},
|
||||
"count": 0
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 1024,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 0
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 1,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 128,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 2
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 1024,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 7
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 4096,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 1866
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 8192,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 3858
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 128,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 128,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 128,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 0
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 256,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 3
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
"bits": 2
|
||||
},
|
||||
"count": 133
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"max_entries": 8192,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 1
|
||||
}
|
||||
"max_entries": 8192,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
"bits": 2
|
||||
},
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 1024,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 29
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 64,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 64
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
"bits": 2
|
||||
},
|
||||
"count": 780
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 4,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 2
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
"bits": 2
|
||||
},
|
||||
"count": 5362
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
"max_entries": 256,
|
||||
"fixed_userdata_size": null,
|
||||
"count": 24
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue