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,
A helper trait to make converting a