coolreader18 opened PR #5220 from store-fuel_remaining-set_fuel
to main
:
Resolves #5109. As discussed there, adds
Store::set_fuel
andStore::fuel_remaining
, which sets the absolute amount of fuel in the store and returns the amount of fuel remaining in the store respectively. In updating the examples and tests, I was already able to change some stuff to be nicer/express intent more clearly. (set_fuel
provides more of a use forfuel_consumed
! e.g. see examples/fuel.rs).This feature doesn't have a maintainer assigned.
fitzgen submitted PR review.
fitzgen submitted PR review.
fitzgen created PR review comment:
Or
add_fuel
, right?
coolreader18 created PR review comment:
Ach, sorry this took so long to respond to; but no, add_fuel doesn't reset the fuel counter, that's why
fuel_adj
exists. add_fuel does likefuel += arg; fuel_adj += arg;
so thatfuel_consumed
can returnfuel_adj - fuel
. There was a discussion somewhere I saw about concerns with fuel_adj overflowing and personally I'm skeptical of the use-case for fuel_consumed tracking across multiple add_fuels (maybe that's what the c-api requires?), but it'd be a breaking change to change that and I just wanted to provide an alternative with this.
coolreader18 submitted PR review.
alexcrichton closed without merge PR #5220.
Last updated: Dec 23 2024 at 12:05 UTC