pub struct TwoPoints {
pub real: Point,
pub ghost: Option<Point>,
}Expand description
A struct used to exactly pinpoint a position in Text, used
when printing.
This struct has two inner components, a real Point, and a
ghost Option<Point>. The second component is used whenever
you want to print a Ghost Text, either fully or partially.
The ghost component represents the “sum position” of all
Ghosts in that same byte. For example if there are two ghosts in
a single byte, if you pass ghost == ghost1.len(), then only the
second ghost will be included in this iteration.
TwoPoints::default will include the first Ghost.
Fields§
§real: PointThe real Point in the Text.
ghost: Option<Point>A possible point in a Ghost.
A value of None means that this is either at the end of
the ghosts at a byte (i.e. this TwoPoints represents a real
character), or this byte index doesn’t have any ghosts at all.
A value of Some means that this TwoPoints does not
represent a real character, so it points to a character
belonging to a Ghost
If you don’t know how to set this value, you should try to use
the new, new_before_ghost or new_after_ghost
functions.
Implementations§
Source§impl TwoPoints
impl TwoPoints
Sourcepub const fn new(real: Point, ghost: Point) -> Self
pub const fn new(real: Point, ghost: Point) -> Self
Returns a fully qualified TwoPoints.
This will include a precise real Point as well as a
precise ghost Point.
If you don’t want to deal with ghosts, see
TwoPoints::new_before_ghost and
TwoPoints::new_after_ghost.