pub struct DatabaseLoader<'config> { /* private fields */ }Expand description
Builder for loading files into a Database from the filesystem and memory.
Implementations§
Source§impl<'config> DatabaseLoader<'config>
impl<'config> DatabaseLoader<'config>
pub fn new(configuration: DatabaseConfiguration<'config>) -> Self
Sourcepub fn with_git_ignores(self, ignores: Arc<GitIgnores>) -> Self
pub fn with_git_ignores(self, ignores: Arc<GitIgnores>) -> Self
Load source files that Git ignores as vendored files, like includes.
pub fn with_database(self, database: Database<'config>) -> Self
Sourcepub fn with_stdin_override(
self,
logical_name: impl AsRef<[u8]>,
content: Vec<u8>,
) -> Self
pub fn with_stdin_override( self, logical_name: impl AsRef<[u8]>, content: Vec<u8>, ) -> Self
When set, the file with this logical name (workspace-relative path) will use the given content instead of being read from disk. The logical name is used for baseline and reporting.
content is raw bytes: PHP source is binary-safe, so a buffer piped in via --stdin-input
may not be valid UTF-8.
pub fn add_memory_source( &mut self, name: &'static str, contents: &'static str, file_type: FileType, )
Sourcepub fn load(self) -> Result<Database<'config>, DatabaseError>
pub fn load(self) -> Result<Database<'config>, DatabaseError>
Loads files from disk into the database.
§Errors
Returns a DatabaseError if:
- A glob pattern is invalid
- File system operations fail (reading directories, files)
- A file exceeds the maximum supported size
Sourcepub fn load_with_directory_symlinks(
self,
) -> Result<(Database<'config>, Vec<PathBuf>), DatabaseError>
pub fn load_with_directory_symlinks( self, ) -> Result<(Database<'config>, Vec<PathBuf>), DatabaseError>
Load files and retain directory symlinks found during directory walks, including empty ones. Links with missing targets are retained too; their target type is not yet known. File-only globs expose matching files, so they do not discover empty directory symlinks.
§Errors
Returns the same errors as Self::load.
Auto Trait Implementations§
impl<'config> !Freeze for DatabaseLoader<'config>
impl<'config> Forget for DatabaseLoader<'config>
impl<'config> Move for DatabaseLoader<'config>
impl<'config> RefUnwindSafe for DatabaseLoader<'config>where
Vec<u8>: RefUnwindSafe,
Atomic<usize>: RefUnwindSafe,
PathBuf: RefUnwindSafe,
String: RefUnwindSafe,
Mutex<HashSet<PathBuf, RandomState>>: RefUnwindSafe,
Pool<Cache, Box<dyn Fn() -> Cache + Sync + Send + UnwindSafe + RefUnwindSafe>>: RefUnwindSafe,
Pool<PatternSet, Box<dyn Fn() -> PatternSet + Sync + Send + UnwindSafe + RefUnwindSafe>>: RefUnwindSafe,
Pool<Vec<usize>, fn() -> Vec<usize>>: RefUnwindSafe,
impl<'config> Send for DatabaseLoader<'config>where
RawTable<(Cow<'static, [u8]>, Arc<File>)>: Send,
RawTable<(FileId, Cow<'static, [u8]>)>: Send,
&'config Path: Send,
PathBuf: Send,
RawVecInner: Send,
&'config [u8]: Send,
Vec<u8>: Send,
&'config str: Send,
String: Send,
&'static [u8]: Send,
Mutex<HashSet<PathBuf, RandomState>>: Send,
Arc<GitIgnores>: Send,
impl<'config> Sync for DatabaseLoader<'config>
impl<'config> Unpin for DatabaseLoader<'config>
impl<'config> UnsafeUnpin for DatabaseLoader<'config>where
*const u8 is !null: UnsafeUnpin,
PhantomData<(Cow<'static, [u8]>, Arc<File>)>: UnsafeUnpin,
PhantomData<(FileId, Cow<'static, [u8]>)>: UnsafeUnpin,
&'config Path: UnsafeUnpin,
PathBuf: UnsafeUnpin,
PhantomData<Cow<'config, [u8]>>: UnsafeUnpin,
PhantomData<Exclusion<'config>>: UnsafeUnpin,
PhantomData<(&'static [u8], &'static [u8], FileType)>: UnsafeUnpin,
&'config [u8]: UnsafeUnpin,
Vec<u8>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
PhantomData<(PathBuf, ())>: UnsafeUnpin,
*const ArcInner<GitIgnores> is !null: UnsafeUnpin,
PhantomData<ArcInner<GitIgnores>>: UnsafeUnpin,
impl<'config> UnwindSafe for DatabaseLoader<'config>where
HashMap<Cow<'static, [u8]>, Arc<File>, RandomState>: UnwindSafe,
HashMap<FileId, Cow<'static, [u8]>, RandomState>: UnwindSafe,
&'config Path: UnwindSafe,
PathBuf: UnwindSafe,
RawVecInner: UnwindSafe,
&'config [u8]: UnwindSafe,
Vec<u8>: UnwindSafe,
&'config str: UnwindSafe,
String: UnwindSafe,
&'static [u8]: UnwindSafe,
Mutex<HashSet<PathBuf, RandomState>>: UnwindSafe,
Arc<GitIgnores>: UnwindSafe,
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
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> ⓘ
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> ⓘ
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