Struct enso_data::text::TextLocation [−][src]
Expand description
A position of character in a multiline text.
Fields
line: usize
Expand description
Line index.
column: usize
Expand description
Column is a index of char in given line.
Implementations
impl TextLocation
[src]
impl TextLocation
[src]pub fn at_line_begin(line_index: usize) -> Self
[src]
pub fn at_line_begin(line_index: usize) -> Self
[src]Create location at begin of given line.
pub fn at_document_begin() -> Self
[src]
pub fn at_document_begin() -> Self
[src]Create location at begin of the whole document.
pub fn at_document_end(content: impl Str) -> Self
[src]
pub fn at_document_end(content: impl Str) -> Self
[src]Create location at and of the whole document. It iterates over all the content.
pub fn from_index(content: impl Str, index: Index) -> Self
[src]
pub fn from_index(content: impl Str, index: Index) -> Self
[src]Convert from index of document with content
. It iterates over all characters before
index
.
pub fn to_index(self, content: impl AsRef<str>) -> Index
[src]
pub fn to_index(self, content: impl AsRef<str>) -> Index
[src]Convert self to the text index.
This operation involves iterating over content characters and is O(n).
Behavior for out-of-bounds index conversion is unspecified but will never panic.
pub fn convert_range(content: impl Str, range: &Range<Index>) -> Range<Self>
[src]
pub fn convert_range(content: impl Str, range: &Range<Index>) -> Range<Self>
[src]Converts a range of indices into a range of TextLocation. It iterates over all characters before range’s end.
pub fn convert_span(content: impl Str, span: &Span) -> Range<Self>
[src]
pub fn convert_span(content: impl Str, span: &Span) -> Range<Self>
[src]Converts a span into a range of TextLocation. It iterates over all characters before range’s end.
Trait Implementations
impl Clone for TextLocation
[src]
impl Clone for TextLocation
[src]fn clone(&self) -> TextLocation
[src]
fn clone(&self) -> TextLocation
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for TextLocation
[src]
impl Debug for TextLocation
[src]impl Display for TextLocation
[src]
impl Display for TextLocation
[src]Short pretty print representation in the form of line:column
.
impl Ord for TextLocation
[src]
impl Ord for TextLocation
[src]impl PartialEq<TextLocation> for TextLocation
[src]
impl PartialEq<TextLocation> for TextLocation
[src]fn eq(&self, other: &TextLocation) -> bool
[src]
fn eq(&self, other: &TextLocation) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &TextLocation) -> bool
[src]
fn ne(&self, other: &TextLocation) -> bool
[src]This method tests for !=
.
impl PartialOrd<TextLocation> for TextLocation
[src]
impl PartialOrd<TextLocation> for TextLocation
[src]fn partial_cmp(&self, other: &TextLocation) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &TextLocation) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for TextLocation
[src]
impl Eq for TextLocation
[src]
impl StructuralEq for TextLocation
[src]
impl StructuralPartialEq for TextLocation
[src]
Auto Trait Implementations
impl RefUnwindSafe for TextLocation
impl Send for TextLocation
impl Sync for TextLocation
impl Unpin for TextLocation
impl UnwindSafe for TextLocation
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> HasRefValue for T where
T: ?Sized,
[src]
impl<T> HasRefValue for T where
T: ?Sized,
[src]type RefValue = T
impl<T> PhantomConversions for T
[src]
impl<T> PhantomConversions for T
[src]fn phantom_into<P>() -> P where
Self: PhantomInto<P>,
[src]
Self: PhantomInto<P>,
fn phantom_from<P>() -> Self where
P: PhantomInto<Self>,
[src]
P: PhantomInto<Self>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> TypeDisplay for T
[src]
impl<T> TypeDisplay for T
[src]pub default fn type_display() -> String
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,