Skip to content

Segments cannot contain maximum value. #2

@RobertDurfee

Description

@RobertDurfee

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions