pub struct SimpleFiles<Name, Source> { /* private fields */ }
Expand description

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§

Create a new files database.

Add a file to the database, returning the handle that can be used to refer to it again.

Get the file corresponding to the given id.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
A unique identifier for files in the file provider. This will be used for rendering diagnostic::Labels in the corresponding source files.
The user-facing name of a file, to be displayed in diagnostics.
The source code of a file.
The user-facing name of a file.
The source code of a file.
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
The byte range of line in the source of the file.
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
The user-facing column number at the given line index and byte index. Read more
Convenience method for returning line and column number at the given byte index in the file.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.