Struct hime_redist::text::Text
source · pub struct Text { /* private fields */ }
Expand description
Represents the input of parser with some metadata for line endings All line numbers and column numbers are 1-based. Indices in the content are 0-based.
Implementations§
source§impl Text
impl Text
sourcepub fn from_utf16_stream(input: &mut dyn Read, big_endian: bool) -> Text
pub fn from_utf16_stream(input: &mut dyn Read, big_endian: bool) -> Text
Initializes this text from a UTF-16 stream
sourcepub fn from_utf8_stream(input: &mut dyn Read) -> Text
pub fn from_utf8_stream(input: &mut dyn Read) -> Text
Initializes this text from a UTF-8 stream
sourcepub fn get_line_count(&self) -> usize
pub fn get_line_count(&self) -> usize
Gets the number of lines
sourcepub fn is_end(&self, index: usize) -> bool
pub fn is_end(&self, index: usize) -> bool
Gets whether the specified index is after the end of the text represented by this object
sourcepub fn get_value(&self, index: usize, length: usize) -> String
pub fn get_value(&self, index: usize, length: usize) -> String
Gets the substring beginning at the given index with the given length
sourcepub fn get_value_for(&self, span: TextSpan) -> String
pub fn get_value_for(&self, span: TextSpan) -> String
Get the substring corresponding to the specified span
sourcepub fn get_line_index(&self, line: usize) -> usize
pub fn get_line_index(&self, line: usize) -> usize
Gets the starting index of the i-th line
sourcepub fn get_line_length(&self, line: usize) -> usize
pub fn get_line_length(&self, line: usize) -> usize
Gets the length of the i-th line
sourcepub fn get_line_content(&self, line: usize) -> String
pub fn get_line_content(&self, line: usize) -> String
Gets the string content of the i-th line
sourcepub fn get_position_at(&self, index: usize) -> TextPosition
pub fn get_position_at(&self, index: usize) -> TextPosition
Gets the position at the given index
sourcepub fn get_context_at(&self, position: TextPosition) -> TextContext
pub fn get_context_at(&self, position: TextPosition) -> TextContext
Gets the context description for the current text at the specified position
sourcepub fn get_context_for(
&self,
position: TextPosition,
length: usize
) -> TextContext
pub fn get_context_for(
&self,
position: TextPosition,
length: usize
) -> TextContext
Gets the context description for the current text at the specified position
sourcepub fn get_context_of(&self, span: TextSpan) -> TextContext
pub fn get_context_of(&self, span: TextSpan) -> TextContext
Gets the context description for the current text at the specified span