Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impl Serialize/Deserialize for RangeFull, RangeToInclusive #2685

Open
elbaro opened this issue Jan 31, 2024 · 0 comments · May be fixed by #2686
Open

Impl Serialize/Deserialize for RangeFull, RangeToInclusive #2685

elbaro opened this issue Jan 31, 2024 · 0 comments · May be fixed by #2686

Comments

@elbaro
Copy link

elbaro commented Jan 31, 2024

#2471 implemented Range{From,Full,To} but RangeFull was omitted for lack of use cases.
Here is a use case:

I have a grid API where a user can add rectangular items with range syntax.

let mut grid = Grid::new();
grid.push(2, 3, item1);
grid.push(.., 2, item2);
grid.push(1, ..=1, item3);

This represents

    2
3 3 2
    2   1

The full range .. is very handy notation for filling up the space.
RangeToInclusive ..= can always be replaced by RangeTo, but it's naturally expected for ergonomic API that any place accepting RangeTo also accepts RangeToInclusive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant