pub struct File<'tu> { /* private fields */ }
Expand description
A source file.
Implementations
sourceimpl<'tu> File<'tu>
impl<'tu> File<'tu>
sourcepub fn get_contents(&self) -> Option<String>
pub fn get_contents(&self) -> Option<String>
Returns the contents of this file, if this file has been loaded.
sourcepub fn get_module(&self) -> Option<Module<'tu>>
pub fn get_module(&self) -> Option<Module<'tu>>
Returns the module containing this file, if any.
sourcepub fn get_skipped_ranges(&self) -> Vec<SourceRange<'tu>>
pub fn get_skipped_ranges(&self) -> Vec<SourceRange<'tu>>
Returns the source ranges in this file that were skipped by the preprocessor.
This will always return an empty Vec
if the translation unit that contains this file was
not constructed with a detailed preprocessing record.
sourcepub fn is_include_guarded(&self) -> bool
pub fn is_include_guarded(&self) -> bool
Returns whether this file is guarded against multiple inclusions.
sourcepub fn get_location(&self, line: u32, column: u32) -> SourceLocation<'tu>
pub fn get_location(&self, line: u32, column: u32) -> SourceLocation<'tu>
Returns the source location at the supplied line and column in this file.
Panics
line
orcolumn
is0
sourcepub fn get_offset_location(&self, offset: u32) -> SourceLocation<'tu>
pub fn get_offset_location(&self, offset: u32) -> SourceLocation<'tu>
Returns the source location at the supplied character offset in this file.
sourcepub fn get_includes(&self) -> Vec<Entity<'tu>>
pub fn get_includes(&self) -> Vec<Entity<'tu>>
Returns the inclusion directives in this file.
sourcepub fn get_references(&self, entity: Entity<'tu>) -> Vec<Entity<'tu>>
pub fn get_references(&self, entity: Entity<'tu>) -> Vec<Entity<'tu>>
Returns the references to the supplied entity in this file.
sourcepub fn visit_includes<F: FnMut(Entity<'tu>, SourceRange<'tu>) -> bool>(
&self,
f: F
) -> bool
pub fn visit_includes<F: FnMut(Entity<'tu>, SourceRange<'tu>) -> bool>(
&self,
f: F
) -> bool
Visits the inclusion directives in this file and returns whether visitation was ended by the
callback returning false
.
sourcepub fn visit_references<F: FnMut(Entity<'tu>, SourceRange<'tu>) -> bool>(
&self,
entity: Entity<'tu>,
f: F
) -> bool
pub fn visit_references<F: FnMut(Entity<'tu>, SourceRange<'tu>) -> bool>(
&self,
entity: Entity<'tu>,
f: F
) -> bool
Visits the references to the supplied entity in this file and returns whether visitation was
ended by the callback returning false
.
Trait Implementations
impl<'tu> Copy for File<'tu>
impl<'tu> Eq for File<'tu>
Auto Trait Implementations
impl<'tu> RefUnwindSafe for File<'tu>
impl<'tu> !Send for File<'tu>
impl<'tu> !Sync for File<'tu>
impl<'tu> Unpin for File<'tu>
impl<'tu> UnwindSafe for File<'tu>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more