Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'lib/text-size/src/lib.rs')
| -rw-r--r-- | lib/text-size/src/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/text-size/src/lib.rs b/lib/text-size/src/lib.rs index b39cb186c1..07dc5e80f4 100644 --- a/lib/text-size/src/lib.rs +++ b/lib/text-size/src/lib.rs @@ -1,5 +1,19 @@ //! Newtypes for working with text sizes/ranges in a more type-safe manner. //! +//! This library can help with two things: +//! * Reducing storage requirenments 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 overhelming 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, than sticking to `usize` would +//! be better. +//! //! Minimal Supported Rust Version: latest stable. #![forbid(unsafe_code)] |