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

Implent Serialize/Deserialize for Range #796

Closed
rocallahan opened this issue Mar 1, 2017 · 3 comments
Closed

Implent Serialize/Deserialize for Range #796

rocallahan opened this issue Mar 1, 2017 · 3 comments

Comments

@rocallahan
Copy link
Contributor

... when T is Serialize/Deserialize, of course.

@dtolnay
Copy link
Member

dtolnay commented Mar 1, 2017

Any preference for what the representation would be? Something like 3..6 could be either

[3, 4, 5]

... or

{
  "start": 3,
  "end": 6
}

Another important thing to consider is whether people will ever need to deserialize a range without knowing ahead of time whether it is Range or RangeFrom or RangeTo or RangeFull.

Can you provide a bit more detail about your use case for this?

@rocallahan
Copy link
Contributor Author

rocallahan commented Mar 1, 2017

{
  "start": 3,
  "end": 6
}

That's all a Range is.

Another important thing to consider is whether people will ever need to deserialize a range without knowing ahead of time whether it is Range or RangeFrom or RangeTo or RangeFull.

No idea, but that would only come up when you consider whether/how to implement Serialize/Deserialize for RangeArgument, which isn't even stable yet.

Can you provide a bit more detail about your use case for this?

I have a struct containing a field that's of type Range<MyLocalType> and I want to auto-derive Serialize and Deserialize for it, but I can't. I can't implement Serialize/Deserialize for Range<MyLocalType> in my own crate because of the orphan rules.

@Altair-Bueno
Copy link

Any plans for RangeFrom, RangeInclusive...?

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

No branches or pull requests

3 participants