#formatter #linter #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

#28 in #linter

Download history 58/week @ 2024-01-01 310/week @ 2024-01-08 384/week @ 2024-01-15 1235/week @ 2024-01-22 1624/week @ 2024-01-29 1576/week @ 2024-02-05 1195/week @ 2024-02-12 958/week @ 2024-02-19 1320/week @ 2024-02-26 1764/week @ 2024-03-04 1599/week @ 2024-03-11 1117/week @ 2024-03-18 691/week @ 2024-03-25 1084/week @ 2024-04-01 542/week @ 2024-04-08 1500/week @ 2024-04-15

3,849 downloads per month
Used in 29 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–275KB