pub struct SourceText { /* private fields */ }Implementations§
Source§impl SourceText
impl SourceText
pub fn new(text: impl Into<String>) -> Self
pub fn with_file_name( text: impl Into<String>, file_name: impl Into<String>, ) -> Self
pub fn as_str(&self) -> &str
pub fn file_name(&self) -> Option<&str>
pub fn content(&self) -> &str
pub fn content_start(&self) -> usize
pub fn content_span(&self) -> Span
pub fn has_leading_bom(&self) -> bool
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn line_count(&self) -> usize
pub fn line_starts(&self) -> &[usize]
pub fn line(&self, index: usize) -> Option<SourceLine>
pub fn line_text(&self, index: usize) -> Option<&str>
pub fn line_with_ending(&self, index: usize) -> Option<&str>
pub fn line_ending(&self, index: usize) -> Option<LineEnding>
pub fn slice(&self, span: Span) -> Option<&str>
pub fn line_column(&self, offset: usize) -> Option<LineColumn>
pub fn line_column_span(&self, span: Span) -> Option<LineColumnSpan>
pub fn byte_offset(&self, position: LineColumn) -> Option<usize>
Trait Implementations§
Source§impl Clone for SourceText
impl Clone for SourceText
Source§impl Debug for SourceText
impl Debug for SourceText
impl Eq for SourceText
Source§impl PartialEq for SourceText
impl PartialEq for SourceText
impl StructuralPartialEq for SourceText
Auto Trait Implementations§
impl Freeze for SourceText
impl RefUnwindSafe for SourceText
impl Send for SourceText
impl Sync for SourceText
impl Unpin for SourceText
impl UnsafeUnpin for SourceText
impl UnwindSafe for SourceText
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
Mutably borrows from an owned value. Read more