diff --git a/src/unused.txt b/src/unused.txt deleted file mode 100644 index 9f5ca93..0000000 --- a/src/unused.txt +++ /dev/null @@ -1,64 +0,0 @@ -fn print_type_of(_: &T) { - println!("{}", std::any::type_name::()); -} - -// Actions field of notication -struct NotifAction<'a> { - action_id: &'a str, - action: &'a str, -} - -impl fmt::Display for NotifAction<'_> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - writeln!(f, "{}: {}", &self.action_id, &self.action)?; - - Ok(()) - } -} - -// Structure of a notification -struct Notif<'a> { - app_name: &'a str, - replace_id: u32, - ico: &'a str, - summary: &'a str, - body: &'a str, - actions: &'a [&'a str], - hints: HashMap<&'a str, &'a zbus::zvariant::Value<'a >>, - expir_timeout: i32, -} - -// Function to print the contents of the notification -impl fmt::Display for Notif<'_> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - writeln!(f, "AppName: {}", &self.app_name)?; - writeln!(f, "ReplaceId: {}", &self.replace_id)?; - write!( - f, - "Icon: {}\nSummary: {}\nBody: {}\nActions:\n", - &self.ico, &self.summary, &self.body - )?; - - let actions_len = self.actions.len(); - let mut i = 0; - - while i < actions_len { - let a = NotifAction { - action_id: &self.actions[i], - action: &self.actions[i+1], - }; - println!("{a}"); - i += 2; - }; - writeln!(f, "Hints:")?; - for (key, value) in &self.hints { - writeln!(f, "\t{key}: {value}")?; - } - match self.expir_timeout { - -1 => writeln!(f, "None")?, - _ => writeln!(f, "Expiration Timeout: {}", self.expir_timeout)?, - //None => writeln!(f, "Error getting timeout")?, - } - Ok(()) // Return Ok to indicate success - } -} \ No newline at end of file