pub trait DbWithTestSystem: Db + Sized {
// Required methods
fn test_system(&self) -> &TestSystem;
fn test_system_mut(&mut self) -> &mut TestSystem;
// Provided methods
fn write_virtual_file(
&mut self,
path: impl AsRef<SystemVirtualPath>,
content: impl AsRef<[u8]>,
) { ... }
fn use_system<S>(&mut self, os: S)
where S: WritableSystem + Send + Sync + RefUnwindSafe + 'static { ... }
fn memory_file_system(&self) -> &MemoryFileSystem { ... }
}Expand description
Extension trait for databases that use TestSystem.
Provides various helper function that ease testing.
Required Methods§
fn test_system(&self) -> &TestSystem
fn test_system_mut(&mut self) -> &mut TestSystem
Provided Methods§
Sourcefn write_virtual_file(
&mut self,
path: impl AsRef<SystemVirtualPath>,
content: impl AsRef<[u8]>,
)
fn write_virtual_file( &mut self, path: impl AsRef<SystemVirtualPath>, content: impl AsRef<[u8]>, )
Sourcefn use_system<S>(&mut self, os: S)
fn use_system<S>(&mut self, os: S)
Uses the given system instead of the testing system.
This useful for testing advanced file system features like permissions, symlinks, etc.
Note that any files written to the memory file system won’t be copied over.
Sourcefn memory_file_system(&self) -> &MemoryFileSystem
fn memory_file_system(&self) -> &MemoryFileSystem
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".