Added PluginContext
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
use std::fmt::Write;
|
||||
use chrono::prelude::*;
|
||||
use dim_sdk::{plugin_info, DimPlugin};
|
||||
use dim_sdk::{plugin_info, Context, DimPlugin};
|
||||
|
||||
plugin_info!(
|
||||
Plug, // Your main global structs name that implements `DimPlugin`
|
||||
"clock", // Plugin name
|
||||
"0.0.0", // Plugin Version (leave empty for none)
|
||||
"GPLv3" // Plugin license (leave empty for none)
|
||||
);
|
||||
);
|
||||
|
||||
|
||||
struct Plug {
|
||||
}
|
||||
@@ -20,9 +21,7 @@ impl Plug {
|
||||
}
|
||||
|
||||
impl DimPlugin for Plug {
|
||||
fn init(&mut self) {
|
||||
}
|
||||
|
||||
fn init(&mut self, _ctx: Context) {}
|
||||
fn poll(&mut self, f: &mut dim_sdk::CBuffer) -> dim_sdk::Result<()> {
|
||||
let local: DateTime<Local> = Local::now();
|
||||
let formatted_time = local.format("%H:%M (%Y-%m-%d)").to_string();
|
||||
@@ -30,14 +29,9 @@ impl DimPlugin for Plug {
|
||||
write!(f, "Time: {}", formatted_time)?;
|
||||
Ok(())
|
||||
}
|
||||
fn pre_reload(&mut self) {
|
||||
|
||||
}
|
||||
fn post_reload(&mut self) {
|
||||
|
||||
}
|
||||
fn free(&mut self) {
|
||||
}
|
||||
fn pre_reload(&mut self) {}
|
||||
fn post_reload(&mut self) {}
|
||||
fn free(&mut self) {}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user