Struct source_span::Layout [−][src]
pub struct Layout<M: Metrics> { /* fields omitted */ }
Expand description
Text layout.
Keep track of the byte index of each line in a UTF8-encoded so it can be indexed by cursor position.
Implementations
Create a new layout from a char
iterator.
Try to create a new layout from an unreliable char
iterator.
Get the byte index mapping to the given position in the input string slice.
It is assumed that the input string slice matches the layout. Otherwise, the returned index may not point to an UTF8 character boundary nor even be in the slice bounds.
Get the sub slice of the input string matching the given span.
Trait Implementations
Extends a collection with the contents of an iterator. Read more
🔬 This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
🔬 This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more