pub trait DbWithWritableSystem: Db + Sized {
type System: WritableSystem;
// Required method
fn writable_system(&self) -> &Self::System;
// Provided methods
fn write_file(
&mut self,
path: impl AsRef<SystemPath>,
content: impl AsRef<str>,
) -> Result<()> { ... }
fn write_dedented(&mut self, path: &str, content: &str) -> Result<()> { ... }
fn write_files<P, C, I>(&mut self, files: I) -> Result<()>
where I: IntoIterator<Item = (P, C)>,
P: AsRef<SystemPath>,
C: AsRef<str> { ... }
}Expand description
Extension trait for databases that use a WritableSystem.
Provides various helper function that ease testing.
Required Associated Types§
type System: WritableSystem
Required Methods§
fn writable_system(&self) -> &Self::System
Provided Methods§
Sourcefn write_file(
&mut self,
path: impl AsRef<SystemPath>,
content: impl AsRef<str>,
) -> Result<()>
fn write_file( &mut self, path: impl AsRef<SystemPath>, content: impl AsRef<str>, ) -> Result<()>
Writes the content of the given file and notifies the Db about the change.
Sourcefn write_dedented(&mut self, path: &str, content: &str) -> Result<()>
fn write_dedented(&mut self, path: &str, content: &str) -> Result<()>
Writes auto-dedented text to a file.
Sourcefn write_files<P, C, I>(&mut self, files: I) -> Result<()>
fn write_files<P, C, I>(&mut self, files: I) -> Result<()>
Writes the content of the given files and notifies the Db about the change.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".