Skip to main content

Db

Trait Db 

Source
pub trait Db: Database {
    // Required methods
    fn file_text(&self, file: FileId) -> Option<FileText>;
    fn engine(&self) -> Option<&'static EngineApi>;
    fn source_root(&self) -> Option<SourceRoot>;
    fn project_config(&self) -> Option<ProjectConfig>;
}
Expand description

The database trait gdscript-hir / gdscript-ide depend on. #[salsa::db] on the trait makes it a salsa supertrait, so any &dyn Db upcasts to &dyn salsa::Database and every #[salsa::tracked] free function downstream can take db: &dyn Db.

Required Methods§

Source

fn file_text(&self, file: FileId) -> Option<FileText>

The text input for file, or None if no text has been set for it.

Source

fn engine(&self) -> Option<&'static EngineApi>

The bundled engine model, or None on wasm32 (no embedded blob — the host wires the fetched blob in via EngineApi::from_bytes in Phase 5).

Source

fn source_root(&self) -> Option<SourceRoot>

The project’s file set, or None before any file has been applied. Project-wide queries (the global class_name registry) take this as their salsa-tracked input.

Source

fn project_config(&self) -> Option<ProjectConfig>

The project’s project.godot config, or None in single-file mode. The autoload registry (M4) takes this as its salsa-tracked input.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§