[−][src]Struct conrod_core::text::cursor::Index
An index representing the position of a cursor within some text.
Fields
line: usize
The index of the line upon which the cursor is situated.
char: usize
The index within all possible cursor positions for the line.
For example, for the line foo
, a char
of 1
would indicate the cursor's position
as f|oo
where |
is the cursor.
Implementations
impl Index
[src]
pub fn previous_word_start<I>(self, text: &str, line_infos: I) -> Option<Self> where
I: Iterator<Item = Info>,
[src]
I: Iterator<Item = Info>,
The cursor index of the beginning of the word (block of non-whitespace) before self
.
If self
is at the beginning of the line, call previous, which returns the last
index position of the previous line, or None if it's the first line
If self
points to whitespace, skip past that whitespace, then return the index of
the start of the word that precedes the whitespace
If self
is in the middle or end of a word, return the index of the start of that word
pub fn next_word_end<I>(self, text: &str, line_infos: I) -> Option<Self> where
I: Iterator<Item = Info>,
[src]
I: Iterator<Item = Info>,
The cursor index of the end of the first word (block of non-whitespace) after self
.
If self
is at the end of the text, this returns None
.
If self
is at the end of a line other than the last, this returns the first index of
the next line.
If self
points to whitespace, skip past that whitespace, then return the index of
the end of the word after the whitespace
If self
is in the middle or start of a word, return the index of the end of that word
pub fn previous<I>(self, line_infos: I) -> Option<Self> where
I: Iterator<Item = Info>,
[src]
I: Iterator<Item = Info>,
The cursor index that comes before self
.
If self
is at the beginning of the text, this returns None
.
If self
is at the beginning of a line other than the first, this returns the last
index position of the previous line.
If self
is a position other than the start of a line, it will return the position
that is immediately to the left.
pub fn next<I>(self, line_infos: I) -> Option<Self> where
I: Iterator<Item = Info>,
[src]
I: Iterator<Item = Info>,
The cursor index that follows self
.
If self
is at the end of the text, this returns None
.
If self
is at the end of a line other than the last, this returns the first index of
the next line.
If self
is a position other than the end of a line, it will return the position that
is immediately to the right.
pub fn clamp_to_lines<I>(self, line_infos: I) -> Self where
I: Iterator<Item = Info>,
[src]
I: Iterator<Item = Info>,
Clamps self
to the given lines.
If self
would lie after the end of the last line, return the index at the end of the
last line.
If line_infos
is empty, returns cursor at line=0 char=0.
Trait Implementations
impl Clone for Index
[src]
impl Copy for Index
[src]
impl Debug for Index
[src]
impl Eq for Index
[src]
impl Ord for Index
[src]
fn cmp(&self, other: &Index) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Index> for Index
[src]
impl PartialOrd<Index> for Index
[src]
fn partial_cmp(&self, other: &Index) -> Option<Ordering>
[src]
fn lt(&self, other: &Index) -> bool
[src]
fn le(&self, other: &Index) -> bool
[src]
fn gt(&self, other: &Index) -> bool
[src]
fn ge(&self, other: &Index) -> bool
[src]
impl StructuralEq for Index
[src]
impl StructuralPartialEq for Index
[src]
Auto Trait Implementations
impl RefUnwindSafe for Index
impl Send for Index
impl Sync for Index
impl Unpin for Index
impl UnwindSafe for Index
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Style for T where
T: Any + Debug + PartialEq<T>,
[src]
T: Any + Debug + PartialEq<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,