deleted unwanted file

This commit is contained in:
Candifloss 2024-09-18 00:05:28 +05:30
parent 2667769356
commit d33ee29eb3

View File

@ -1,64 +0,0 @@
fn print_type_of<T>(_: &T) {
println!("{}", std::any::type_name::<T>());
}
// 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
}
}