pub struct SourceFileInner { /* private fields */ }
Implementations§
Source§impl SourceFileInner
impl SourceFileInner
pub fn new(path: PathBuf, source: String) -> Self
pub fn path(&self) -> &Path
Sourcepub fn from_path_only(path: PathBuf) -> Rc<Self>
pub fn from_path_only(path: PathBuf) -> Rc<Self>
Create a SourceFile that has just a path, but no contents
Sourcepub fn line_column(&self, offset: usize) -> (usize, usize)
pub fn line_column(&self, offset: usize) -> (usize, usize)
Returns a tuple with the line (starting at 1) and column number (starting at 1)
pub fn text_size_to_file_line_column( &self, size: TextSize, ) -> (String, usize, usize, usize, usize)
Sourcepub fn offset(&self, line: usize, column: usize) -> usize
pub fn offset(&self, line: usize, column: usize) -> usize
Returns the offset that corresponds to the line/column
pub fn source(&self) -> Option<&str>
Trait Implementations§
Source§impl Debug for SourceFileInner
impl Debug for SourceFileInner
Source§impl Default for SourceFileInner
impl Default for SourceFileInner
Source§fn default() -> SourceFileInner
fn default() -> SourceFileInner
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for SourceFileInner
impl !RefUnwindSafe for SourceFileInner
impl Send for SourceFileInner
impl !Sync for SourceFileInner
impl Unpin for SourceFileInner
impl UnwindSafe for SourceFileInner
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more