Skip to content
New issue

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

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

Already on GitHub? # to your account

Segments cannot contain maximum value. #2

Open
RobertDurfee opened this issue Aug 12, 2020 · 0 comments
Open

Segments cannot contain maximum value. #2

RobertDurfee opened this issue Aug 12, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@RobertDurfee
Copy link
Owner

RobertDurfee commented Aug 12, 2020

Unfortunately, given how segments are represented as closed-open intervals, the maximum value cannot be included in the segment. I have not yet determined a simple, consistent way to address this. For now, this is not a main concern for me as the current implementation fits my needs well enough.

Workarounds:

  • For any of the numeric types, the maximum value should just not be considered a valid value. For example, valid Unicode is from U+0000 to U+10FFFF. Therefore, when representing Unicode using u32, it is safe to ignore 0xFFFFFFFF.
  • For an enumerated type (support for convenience constructors--like closed and all--coming soon with It doesn't make sense to have enumerated types implement num::One, num::Zero, or std::ops::Add. #1), simply append an Unused (or similar) variant to the list of variants. Then, the default #[derive(Ord, PartialOrd)] will have that as the maximum value.
@RobertDurfee RobertDurfee added the bug Something isn't working label Aug 12, 2020
@RobertDurfee RobertDurfee self-assigned this Aug 12, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant