pub struct Sources { /* private fields */ }Expand description
A collection of source files, and a queue of things to compile.
Implementations
sourceimpl Sources
impl Sources
sourcepub fn get(&self, id: SourceId) -> Option<&Source>
pub fn get(&self, id: SourceId) -> Option<&Source>
Get the source matching the given source id.
sourcepub fn insert(&mut self, source: Source) -> SourceId
pub fn insert(&mut self, source: Source) -> SourceId
Insert a source to be built and return its id.
Trait Implementations
sourceimpl<'a> Files<'a> for Sources
impl<'a> Files<'a> for Sources
type FileId = SourceId
type FileId = SourceId
A unique identifier for files in the file provider. This will be used
for rendering diagnostic::Labels in the corresponding source files. Read more
sourcefn name(&'a self, file_id: SourceId) -> Result<Self::Name, Error>
fn name(&'a self, file_id: SourceId) -> Result<Self::Name, Error>
The user-facing name of a file.
sourcefn source(&'a self, file_id: SourceId) -> Result<Self::Source, Error>
fn source(&'a self, file_id: SourceId) -> Result<Self::Source, Error>
The source code of a file.
sourcefn line_index(
&self,
file_id: SourceId,
byte_index: usize
) -> Result<usize, Error>
fn line_index(
&self,
file_id: SourceId,
byte_index: usize
) -> Result<usize, Error>
The index of the line at the given byte index. If the byte index is past the end of the file, returns the maximum line index in the file. This means that this function only fails if the file is not present. Read more
sourcefn line_range(
&self,
file_id: SourceId,
line_index: usize
) -> Result<Range<usize>, Error>
fn line_range(
&self,
file_id: SourceId,
line_index: usize
) -> Result<Range<usize>, Error>
The byte range of line in the source of the file.
sourcefn line_number(
&'a self,
id: Self::FileId,
line_index: usize
) -> Result<usize, Error>
fn line_number(
&'a self,
id: Self::FileId,
line_index: usize
) -> Result<usize, Error>
The user-facing line number at the given line index. It is not necessarily checked that the specified line index is actually in the file. Read more
Auto Trait Implementations
impl RefUnwindSafe for Sources
impl Send for Sources
impl Sync for Sources
impl Unpin for Sources
impl UnwindSafe for Sources
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> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more