// auto-imports use crate::config::Config; // std use std::{ fs::{read_to_string, write}, error::Error, }; // log use log::debug; /// Reads last tweet id from a file pub fn read_state(s: &str) -> Option { let state = read_to_string(s); if let Ok(s) = state { debug!("Last Tweet ID (from file): {}", &s); return s.parse::().ok(); } None } /// Writes last treated tweet id to a file pub fn write_state(f: &str, s: u64) -> Result<(), std::io::Error> { write(f, format!("{}", s)) } /********* * Main functions *********/ /// Initiates the DB from path pub fn init_db(config: &Config) -> Result<(), Box> { println!("config.scootaloo.db_path: {}", config.scootaloo.db_path); Ok(()) }