Add configuration to treat content as a slot #2108
Draft
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.
Like discussed many times before, this adds content as a slot to
ViewComponent so that we can begin separating the block provided when
rendering from content for performance and ergonomic reasons.
This adds two new methods:
content_is_a_slot!
- This makes the component and its descendantstreat
content
as a slot, and the block provided to render calls isalways executed.
do_not_use_content_as_a_slot!
- This keeps the existing behaviorwhere
content
is lazily evaluated and is used to return content.There's likely more implications from this change that need to be walked
through (like how slots are used, and easily setting content) before
this can be merged.