Layout extension trait - #627
Merged
Merged
Conversation
frankmcsherry
marked this pull request as ready for review
July 15, 2025 21:49
Member
Author
|
I'm tempted to say that the complexity (and anxiety) about the layout extension trait might justify just eating the complexity of copy/pasting its contents into each of |
frankmcsherry
force-pushed
the
layout_ext
branch
from
July 16, 2025 13:57
6128c3d to
faceb47
Compare
Member
Author
|
I'm ok merging this, and promise that I'll help undo it if it turns out to be the wrong architecture. But I'm pretty confident that I understand it better now, and that the worst-case scenario is that we inline the |
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The intent here is to provide a
LayoutExtextension trait for types that have aLayoutmember, to provide them with type aliases and methods on them, e.g. "owned key", "borrowed key", "borrowed to owned function".This seems to work, but .. there are some mysterious edits needed to unlock the type inference. On that stood out was changing a
Tr: Trace + TraceReader< ... >bound into aTr: Trace< ...>bound. No idea why Rust needed the constraints in that trait, wheretrait Trace : TraceReader. Perhaps they need to be in the trait at the top of the stack rather than halfway through; I couldn't say.Hesitant to merge without a better understanding of what is going on, and how much maintenance peril we are in. It's all a bit silly because all we are trying to say is "everyone has the same
L: Layout", and .. perhaps the right thing to do is just to add it as a trait argument, e.g.Trace<L>,Batch<L>,Cursor<L>, and life could be better. Though at the same time it really is an associated type: each trait implementations has a single layout in mind.