Skip to main content

state_engine/ports/
default.rs

1use crate::ports::required::FileClient;
2
3pub struct DefaultFileClient;
4
5impl FileClient for DefaultFileClient {
6    fn get(&self, path: &str) -> Option<String> {
7        std::fs::read_to_string(path).ok()
8    }
9    fn set(&self, path: &str, value: String) -> bool {
10        std::fs::write(path, value).is_ok()
11    }
12    fn delete(&self, path: &str) -> bool {
13        std::fs::remove_file(path).is_ok()
14    }
15}