state-engine 0.1.5

Declarative state data management system for process
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::ports::required::FileClient;

pub struct DefaultFileClient;

impl FileClient for DefaultFileClient {
    fn get(&self, path: &str) -> Option<String> {
        std::fs::read_to_string(path).ok()
    }
    fn set(&self, path: &str, value: String) -> bool {
        std::fs::write(path, value).is_ok()
    }
    fn delete(&self, path: &str) -> bool {
        std::fs::remove_file(path).is_ok()
    }
}