Skip to main content

Db

Trait Db 

pub trait Db: Database {
    // Required methods
    fn root(&self) -> CompilationRoot;
    fn source_file<'db>(
        &'db self,
        krate: Krate,
        modules: &[Identifier<'db>],
    ) -> SourceFile;
    fn url_display(&self, url: &Url) -> String;
    fn debug_tx(&self) -> Option<Sender<DebugEvent>>;
}

Required Methods§

fn root(&self) -> CompilationRoot

Access the [CompilationRoot], from which all crates and sources can be reached.

fn source_file<'db>( &'db self, krate: Krate, modules: &[Identifier<'db>], ) -> SourceFile

Load a source-file from the given directory. The modules is a list of parent modules that translates to a file path.

fn url_display(&self, url: &Url) -> String

Convert the url into a string suitable for showing the user.

fn debug_tx(&self) -> Option<Sender<DebugEvent>>

Controls whether type-checking and other parts of the compiler will dump debug logs. If None is returned, no debugging output is emitted. If Some is returned, it should supply a directory where .json files will be created. The dada_debug crate will monitor this directory and serve up the information for use in debugging.

Implementors§