feat(layout): allow layout fill to be configurable #633
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.
feat(layout): allow configuring layout fill
The layout split will generally fill the remaining area when
split()
is called. This change allows the caller to configure how any extra
space is allocated to the
Rect
s. This is useful for cases where thecaller wants to have a fixed size for one of the
Rect
s, and have theother
Rect
s fill the remaining space.For now, the method and enum are marked as unstable because the exact
name is still being bikeshedded. To enable this functionality, add the
unstable-segment-size
feature flag in yourCargo.toml
.To configure the layout to fill the remaining space evenly, use
Layout::segment_size(SegmentSize::EvenDistribution)
. The defaultbehavior is
SegmentSize::LastTakesRemainder
, which gives the lastsegment the remaining space.
SegmentSize::None
will disable thisbehavior. See the docs for
Layout::segment_size()
andlayout::SegmentSize
for more information.Method docs:
Type docs:
Note: I fixed the link to the
Table
widget - just didn't re-screenshot.