1 unstable release

0.0.1 Apr 4, 2023

#54 in #cases

Download history 43/week @ 2024-03-11 38/week @ 2024-03-18 65/week @ 2024-03-25 80/week @ 2024-04-01 28/week @ 2024-04-08 39/week @ 2024-04-15 42/week @ 2024-04-22 35/week @ 2024-04-29 39/week @ 2024-05-06 58/week @ 2024-05-13 28/week @ 2024-05-20 49/week @ 2024-05-27 30/week @ 2024-06-03 35/week @ 2024-06-10 28/week @ 2024-06-17 52/week @ 2024-06-24

145 downloads per month
Used in 15 crates (5 directly)

MIT/Apache

26KB
456 lines

Newtypes for working with text sizes/ranges in a more type-safe manner.

This library can help with two things:

  • Reducing storage requirements for offsets and ranges, under the assumption that 32 bits is enough.
  • Providing standard vocabulary types for applications where text ranges are pervasive.

However, you should not use this library simply because you work with strings. In the overwhelming majority of cases, using usize and std::ops::Range<usize> is better. In particular, if you are publishing a library, using only std types in the interface would make it more interoperable. Similarly, if you are writing something like a lexer, which produces, but does not store text ranges, then sticking to usize would be better.

Minimal Supported Rust Version: latest stable.

Dependencies

~0–260KB