Closed NickCondron closed 1 year ago
Closing because I no longer like my solution even though it is in the right direction. I will give another attempt at this problem soon. As mentioned before the poor ergonomics of the Handlers
trait is blocking the stats work and the usability of peppi more broadly.
The usability of event-based parsing is hindered by the
Handlers
trait functioning at the event-level. This means any implementer has to worry about rollbacks, frame data duplication after character elimination, and handling all sorts of errors. Right now this issue is blocking my progress on stats. I propose to renameHandlers
toEventHandler
and create a new traitGameHandler
Also a struct
Hook
that wraps aGameHandler
and handles all the events feeding theGameHandler
as frames are finalized.That way a user can parse with code like this:
This PR is a nearly finished. TODO:
Handlers
trait altogether~ DONE -- performance is unaffected or slightly improvedGameHandler
. All things related toHook
andEventHandler
can mostly be under the hood.~ DONEFuture work:
EventHandler
/GameHandler
that hints the number of frames the game is expected to have in case it is known in advance (ie. read from a file). This would allow performance improvements with preallocation.