diff --git a/src/lib.rs b/src/lib.rs index 370fed7..c6de5de 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,8 +15,8 @@ pub mod pomodoro { device: &'a Device, } - impl Alert<'_> { - pub fn new<'a, P: AsRef>(path: &'a P, device: &'a Device) -> Alert<'a> { + impl<'a> Alert<'a> { + pub fn new>(path: &'a P, device: &'a Device) -> Alert<'a> { Alert { path: path.as_ref(), device, @@ -30,8 +30,12 @@ pub mod pomodoro { rodio::play_raw(self.device, source.convert_samples()); } } - } + pub fn load>(mut self, new_path: &'a P) -> Self { + self.path = new_path.as_ref(); + self + } + } #[derive(Copy, Clone, Debug)] pub enum State { Work, @@ -75,13 +79,13 @@ pub mod pomodoro { } pub fn with_data_directory>(mut self, path: &P) -> Config { - self.data_directory = path.as_ref().to_owned(); + self.data_directory = path.as_ref().to_path_buf(); self } fn get_data_directory() -> PathBuf { - let dirs = ProjectDirs::from("moe", "paoda", "domasi").unwrap(); - dirs.data_dir().to_owned() + let dirs = ProjectDirs::from("moe", "paoda", "Domasi").unwrap(); + dirs.data_dir().to_path_buf() } }