pub struct DatabaseLoader { /* private fields */ }Expand description
Configures and builds a Database by scanning the filesystem and memory.
Implementations§
Source§impl DatabaseLoader
impl DatabaseLoader
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.
All provided exclusion paths are canonicalized relative to the workspace upon creation to ensure they are matched correctly.
Sourcepub fn with_database(self, database: Database) -> Self
pub fn with_database(self, database: Database) -> Self
Sets a pre-existing database to populate.
Sourcepub fn add_memory_source(
&mut self,
name: &'static str,
contents: &'static str,
file_type: FileType,
)
pub fn add_memory_source( &mut self, name: &'static str, contents: &'static 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.
Auto Trait Implementations§
impl Freeze for DatabaseLoader
impl RefUnwindSafe for DatabaseLoader
impl Send for DatabaseLoader
impl Sync for DatabaseLoader
impl Unpin for DatabaseLoader
impl UnwindSafe for DatabaseLoader
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more