rust-pgn-reader icon indicating copy to clipboard operation
rust-pgn-reader copied to clipboard

Feature request: offsets for games

Open arnsholt opened this issue 5 years ago • 0 comments

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 between begin_game() and begin_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.

arnsholt avatar Apr 23 '19 13:04 arnsholt