Skip to content

Commit

Permalink
refactor: reduce repeated code in state machine
Browse files Browse the repository at this point in the history
This replaces repeated boilerplate code around handling taking/putting
the state with a wrapper type. This wrapper type moves the state machine
itself into a closure, allowing nice things like using ? to return
errors and other early returns. It also makes simple an "Errored" state
for the state machine so that calling the state machine after it's
already returned an error is no longer a panic.

Signed-off-by: Nick Stevens <[email protected]>
  • Loading branch information
nastevens committed Mar 4, 2020
1 parent 9866611 commit 022dbc0
Show file tree
Hide file tree
Showing 4 changed files with 278 additions and 222 deletions.
Loading

0 comments on commit 022dbc0

Please sign in to comment.