1 stable release

1.0.0 Mar 21, 2020

#16 in #substring

CC0 license

11KB
233 lines

Encapsulates the concept of a substring of a certain length found at a given offset, which can be useful when this information cannot be directly coupled to the lifetime of the orignal string it was derived from. This can be useful, for example, when the section of a string which caused a parsing error must be reported in a manner which must survive the lifetime of the original parsed string.

This may sound like an odd set of requirements, but it notably occurs when implementing an external trait (which cannot be modified to take a lifetime parameter) which contains a function which takes a &str -- like, say, std::str::FromStr.

No runtime deps