pub struct MockFileSystem { /* private fields */ }Expand description
Mock file system for testing.
Provides an in-memory HashMap-based storage with RwLock for thread safety.
This enables unit testing validators without requiring real temp files.
Implementations§
Source§impl MockFileSystem
impl MockFileSystem
Sourcepub const MAX_SYMLINK_DEPTH: u32 = 40
pub const MAX_SYMLINK_DEPTH: u32 = 40
Maximum depth for symlink resolution to prevent infinite loops.
This matches the typical OS limit (Linux ELOOP is triggered at 40 levels).
Value chosen to match POSIX SYMLOOP_MAX and Linux’s internal limit.
See: https://man7.org/linux/man-pages/man3/fpathconf.3.html
Sourcepub fn add_file(&self, path: impl AsRef<Path>, content: impl Into<String>)
pub fn add_file(&self, path: impl AsRef<Path>, content: impl Into<String>)
Add a file with the given content
Trait Implementations§
Source§impl Debug for MockFileSystem
impl Debug for MockFileSystem
Source§impl Default for MockFileSystem
impl Default for MockFileSystem
Source§fn default() -> MockFileSystem
fn default() -> MockFileSystem
Returns the “default value” for a type. Read more
Source§impl FileSystem for MockFileSystem
impl FileSystem for MockFileSystem
Source§fn is_symlink(&self, path: &Path) -> bool
fn is_symlink(&self, path: &Path) -> bool
Check if a path is a symlink
Source§fn metadata(&self, path: &Path) -> Result<FileMetadata>
fn metadata(&self, path: &Path) -> Result<FileMetadata>
Get metadata for a path (follows symlinks)
Source§fn symlink_metadata(&self, path: &Path) -> Result<FileMetadata>
fn symlink_metadata(&self, path: &Path) -> Result<FileMetadata>
Get metadata for a path without following symlinks
Source§fn read_to_string(&self, path: &Path) -> LintResult<String>
fn read_to_string(&self, path: &Path) -> LintResult<String>
Read file contents to string (with security checks)
Auto Trait Implementations§
impl !Freeze for MockFileSystem
impl RefUnwindSafe for MockFileSystem
impl Send for MockFileSystem
impl Sync for MockFileSystem
impl Unpin for MockFileSystem
impl UnsafeUnpin for MockFileSystem
impl UnwindSafe for MockFileSystem
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> 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