Skip to main content

DbWithWritableSystem

Trait DbWithWritableSystem 

Source
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§

Required Methods§

Source

fn writable_system(&self) -> &Self::System

Provided Methods§

Source

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.

Source

fn write_dedented(&mut self, path: &str, content: &str) -> Result<()>

Writes auto-dedented text to a file.

Source

fn write_files<P, C, I>(&mut self, files: I) -> Result<()>
where I: IntoIterator<Item = (P, C)>, P: AsRef<SystemPath>, C: AsRef<str>,

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".

Implementors§