Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a new
Input::builder
API.It's intentionally limited for now but we could extend it in the future to e.g. allow setting per-field durability.
Design
I'm not super happy with the implementation. Mainly because it requires a private module to hide most implementation details of theBuilder
.But even then, we don't get perfect encapsulation because theBuilder::create
method is still visible in the input's module. But I'm not sure what else we could do.I had to revert implementing
Configuration
directly on the$Struct
because self-referential types then stopped compiling. Example:salsa/tests/accumulate-reuse.rs
Lines 16 to 20 in 6975a47
What I dislike about the current solution is that
Builder::inner
is accessible from the input's module. But not sure what we should do about it. I tried using atrait
but that's a bit annoying to use because it must be explicitly imported from the ingredient's scope.Tests
I did add a test but I haven't figured out a way to automatically verify if a tracked function was validated using deep or shallow comparison.
I did do some manual testing by adding
dbg
statements that show that Salsa does use the shallow comparison for inputs withDurability::HIGH
.