pub struct DatabaseLoader<'a> { /* private fields */ }Expand description
Configures and builds a Database by scanning the filesystem and memory.
Implementations§
Source§impl<'a> DatabaseLoader<'a>
impl<'a> DatabaseLoader<'a>
Sourcepub fn new(
workspace: PathBuf,
paths: Vec<PathBuf>,
includes: Vec<PathBuf>,
excludes: Vec<Exclusion>,
extensions: Vec<String>,
) -> Self
pub fn new( workspace: PathBuf, paths: Vec<PathBuf>, includes: Vec<PathBuf>, excludes: Vec<Exclusion>, extensions: Vec<String>, ) -> Self
Creates a new loader with the given configuration.
Sourcepub fn add_memory_source(
&mut self,
name: &'a str,
contents: &'a str,
file_type: FileType,
)
pub fn add_memory_source( &mut self, name: &'a str, contents: &'a str, file_type: FileType, )
Adds a memory source to the loader.
This allows you to include files that are not on the filesystem but should be part of the database.
§Arguments
name- The logical name of the file, typically its path relative to the workspace.contents- The contents of the file as a string.file_type- The type of the file, indicating whether it’s a host file or a vendored file.
Sourcepub fn load(&self) -> Result<Database, DatabaseError>
pub fn load(&self) -> Result<Database, DatabaseError>
Scans sources according to the configuration and builds a Database.
This is the main entry point that orchestrates the entire loading process.
It returns a Result as some pre-processing, like compiling globs, can fail.
Auto Trait Implementations§
impl<'a> Freeze for DatabaseLoader<'a>
impl<'a> RefUnwindSafe for DatabaseLoader<'a>
impl<'a> Send for DatabaseLoader<'a>
impl<'a> Sync for DatabaseLoader<'a>
impl<'a> Unpin for DatabaseLoader<'a>
impl<'a> UnwindSafe for DatabaseLoader<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more