[−][src]Struct codespan_reporting::files::SimpleFiles
A file database that can store multiple source files.
This is useful for simple language tests, but it might be worth creating a
custom implementation when a language scales beyond a certain size.
It is a glorified Vec<SimpleFile>
that implements the Files
trait.
Implementations
impl<Name, Source> SimpleFiles<Name, Source> where
Name: Display,
Source: AsRef<str>,
[src]
Name: Display,
Source: AsRef<str>,
pub fn new() -> SimpleFiles<Name, Source>
[src]
Create a new files database.
pub fn add(&mut self, name: Name, source: Source) -> usize
[src]
Add a file to the database, returning the handle that can be used to refer to it again.
pub fn get(&self, file_id: usize) -> Result<&SimpleFile<Name, Source>, Error>
[src]
Get the file corresponding to the given id.
Trait Implementations
impl<Name: Clone, Source: Clone> Clone for SimpleFiles<Name, Source>
[src]
fn clone(&self) -> SimpleFiles<Name, Source>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<Name: Debug, Source: Debug> Debug for SimpleFiles<Name, Source>
[src]
impl<'a, Name, Source> Files<'a> for SimpleFiles<Name, Source> where
Name: 'a + Display + Clone,
Source: 'a + AsRef<str>,
[src]
Name: 'a + Display + Clone,
Source: 'a + AsRef<str>,
type FileId = usize
A unique identifier for files in the file provider. This will be used
for rendering diagnostic::Label
s in the corresponding source files. Read more
type Name = Name
The user-facing name of a file, to be displayed in diagnostics.
type Source = &'a str
The source code of a file.
fn name(&self, file_id: usize) -> Result<Name, Error>
[src]
fn source(&self, file_id: usize) -> Result<&str, Error>
[src]
fn line_index(&self, file_id: usize, byte_index: usize) -> Result<usize, Error>
[src]
fn line_range(
&self,
file_id: usize,
line_index: usize
) -> Result<Range<usize>, Error>
[src]
&self,
file_id: usize,
line_index: usize
) -> Result<Range<usize>, Error>
fn line_number(
&'a self,
id: Self::FileId,
line_index: usize
) -> Result<usize, Error>
[src]
&'a self,
id: Self::FileId,
line_index: usize
) -> Result<usize, Error>
fn column_number(
&'a self,
id: Self::FileId,
line_index: usize,
byte_index: usize
) -> Result<usize, Error>
[src]
&'a self,
id: Self::FileId,
line_index: usize,
byte_index: usize
) -> Result<usize, Error>
fn location(
&'a self,
id: Self::FileId,
byte_index: usize
) -> Result<Location, Error>
[src]
&'a self,
id: Self::FileId,
byte_index: usize
) -> Result<Location, Error>
Auto Trait Implementations
impl<Name, Source> RefUnwindSafe for SimpleFiles<Name, Source> where
Name: RefUnwindSafe,
Source: RefUnwindSafe,
Name: RefUnwindSafe,
Source: RefUnwindSafe,
impl<Name, Source> Send for SimpleFiles<Name, Source> where
Name: Send,
Source: Send,
Name: Send,
Source: Send,
impl<Name, Source> Sync for SimpleFiles<Name, Source> where
Name: Sync,
Source: Sync,
Name: Sync,
Source: Sync,
impl<Name, Source> Unpin for SimpleFiles<Name, Source> where
Name: Unpin,
Source: Unpin,
Name: Unpin,
Source: Unpin,
impl<Name, Source> UnwindSafe for SimpleFiles<Name, Source> where
Name: UnwindSafe,
Source: UnwindSafe,
Name: UnwindSafe,
Source: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,