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.
Sourcepub const fn new_before_ghost(real: Point) -> Self
pub const fn new_before_ghost(real: Point) -> Self
Sourcepub const fn new_after_ghost(real: Point) -> Self
pub const fn new_after_ghost(real: Point) -> Self
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for TwoPoints
impl<'__de, __Context> BorrowDecode<'__de, __Context> for TwoPoints
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl Ord for TwoPoints
impl Ord for TwoPoints
Source§impl PartialOrd for TwoPoints
impl PartialOrd for TwoPoints
impl Copy for TwoPoints
impl Eq for TwoPoints
impl StructuralPartialEq for TwoPoints
Auto Trait Implementations§
impl Freeze for TwoPoints
impl RefUnwindSafe for TwoPoints
impl Send for TwoPoints
impl Sync for TwoPoints
impl Unpin for TwoPoints
impl UnwindSafe for TwoPoints
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.