rust-pgn-reader
rust-pgn-reader copied to clipboard
Feature request: offsets for games
In a project I'm using pgn_reader it'd be very useful if I could get the byte offset where the PGN of a game starts, so that I can seek on the handle to a large PGN file and read only that game.
I've had a peek at the code, and as far as I can make out implementing this requires two changes:
- Changing or extending the Visitor trait, either adding an offset parameter to
begin_game()
or adding a new callback which is called betweenbegin_game()
andbegin_headers()
- Adding a member to BufferedReader keeping track of the current position in the file. From the design of the code, I think the only place the variable needs to be updated is in
consume()
.
Does this sound like a reasonable feature? If so, I'd be happy to pitch in and submit a pull request implementing it.