Module codespan_reporting::files
source · Expand description
Source file support for diagnostic reporting.
The main trait defined in this module is the Files
trait, which provides
provides the minimum amount of functionality required for printing Diagnostics
with the term::emit
function.
Simple implementations of this trait are implemented:
SimpleFile
: For single-file use-casesSimpleFiles
: For multi-file use-cases
These data structures provide a pretty minimal API, however,
so end-users are encouraged to create their own implementations for their
own specific use-cases, such as an implementation that accesses the file
system directly (and caches the line start locations), or an implementation
using an incremental compilation library like salsa
.
Structs
A user-facing location in a source file.
A file database that contains a single source file.
A file database that can store multiple source files.
Enums
An enum representing an error that happened while looking up a file or a piece of content in that file.
Traits
A minimal interface for accessing source files when rendering diagnostics.
Functions
The column index at the given byte index in the source file.
This is the number of characters to the given byte index.
Return the starting byte index of each line in the source string.