[][src]Crate text_size

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

This library can help with two things:

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.

Structs

TextRange

A range in text, represented as a pair of TextSize.

TextSize

A measure of text length. Also, equivalently, an index into text.

Traits

TextLen

Primitives with a textual length that can be passed to TextSize::of.