12 releases (4 breaking)

0.5.7 Mar 12, 2024
0.5.6 Mar 12, 2024
0.4.0 Jan 9, 2024
0.3.1 Nov 26, 2023
0.0.4 Sep 28, 2023

#1805 in Web programming

Download history 8072/week @ 2024-06-12 5411/week @ 2024-06-19 9947/week @ 2024-06-26 4617/week @ 2024-07-03 4336/week @ 2024-07-10 4841/week @ 2024-07-17 6521/week @ 2024-07-24 7632/week @ 2024-07-31 9377/week @ 2024-08-07 5337/week @ 2024-08-14 15159/week @ 2024-08-21 10701/week @ 2024-08-28 12429/week @ 2024-09-04 8848/week @ 2024-09-11 11449/week @ 2024-09-18 8655/week @ 2024-09-25

42,327 downloads per month
Used in 31 crates (6 directly)

MIT/Apache

28KB
468 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–295KB