cartulary 0.3.0-alpha.1

The knowledge layer of your project — decisions, issues, docs, all in one place.
Documentation
//! Filesystem adapters for [`RawTextReader`] / [`RawTextWriter`].
//! Trivial pass-through to [`std::fs`].

use std::path::Path;

use crate::domain::usecases::fmt::{RawTextReader, RawTextWriter};

pub struct FsRawTextReader;

impl RawTextReader for FsRawTextReader {
    fn read(&self, path: &Path) -> anyhow::Result<String> {
        Ok(std::fs::read_to_string(path)?)
    }
}

pub struct FsRawTextWriter;

impl RawTextWriter for FsRawTextWriter {
    fn write(&self, path: &Path, content: &str) -> anyhow::Result<()> {
        std::fs::write(path, content)?;
        Ok(())
    }
}