Remove input data from widget layout syntax items #478
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.
Previously, widgets embedded in input data could support input data. This was rarely ever used within custom widgets but commonly used as part of "widget constructor macros" like
column!
, until #476 made those return named widgets (likeColumn
).We can now remove this feature. Motivation (aside from some simpler code) is that this avoids some confusing errors. For example, the last commit here simply in-lines a widget field which is never accessed nor uses input data:
Without the removal of this feature, that diff results in the following error:
Why? Because widgets declared in-line in layout syntax for custom widgets are placed in the
widget_core!()
struct and expected to support the custom widget's data type; in this case, the field is expected to implementWidget<Data = A>
— but hereA
is a generic of the (outer) widget type, not the core. We could solve that error by copying all generics from the outer widget to the core (or attempt to infer which generics are actually required), but this solution is cleaner. (It's also cleaner because we didn't want to use this input data anyway, and usually don't for widgets declared in layout syntax because these are usually static.)