pub struct SourceFile { /* private fields */ }
Expand description
A source file that is identified by its name. Optionally stores the source code and LineIndex
.
Cloning a SourceFile
is cheap, because it only requires bumping a reference count.
Implementations§
source§impl SourceFile
impl SourceFile
pub fn slice(&self, range: TextRange) -> &str
pub fn to_source_code(&self) -> SourceCode<'_, '_>
sourcepub fn source_text(&self) -> &str
pub fn source_text(&self) -> &str
Returns Some
with the source text if set, or None
.
Trait Implementations§
source§impl Clone for SourceFile
impl Clone for SourceFile
source§fn clone(&self) -> SourceFile
fn clone(&self) -> SourceFile
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SourceFile
impl Debug for SourceFile
source§impl PartialEq for SourceFile
impl PartialEq for SourceFile
source§fn eq(&self, other: &SourceFile) -> bool
fn eq(&self, other: &SourceFile) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for SourceFile
impl StructuralPartialEq for SourceFile
Auto Trait Implementations§
impl Freeze for SourceFile
impl RefUnwindSafe for SourceFile
impl Send for SourceFile
impl Sync for SourceFile
impl Unpin for SourceFile
impl UnwindSafe for SourceFile
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