#parser #formatter #linter #string-parser #web-apps

biome_text_size

Utilities to treat text sizes/ranges in a more type-safe

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

#2020 in Web programming

Download history 7495/week @ 2024-07-21 7653/week @ 2024-07-28 6931/week @ 2024-08-04 8902/week @ 2024-08-11 10668/week @ 2024-08-18 15310/week @ 2024-08-25 8970/week @ 2024-09-01 11187/week @ 2024-09-08 9095/week @ 2024-09-15 10762/week @ 2024-09-22 18616/week @ 2024-09-29 5244/week @ 2024-10-06 16021/week @ 2024-10-13 9629/week @ 2024-10-20 15353/week @ 2024-10-27 4439/week @ 2024-11-03

45,503 downloads per month
Used in 33 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–300KB