redblocks/
plugins.rs

1/*! Library provided plugins
2# Building your own plugins
3
4First you will need to create a struct to hold the information you wish displayed in the status blocks. When implementing the plugin's new() function it is importatn that it return itself in a [`Box`]. Once you have created your status plugin you will need to implement both the [Display](std::fmt::Display) and [Update](crate::Update) traits; the implementation of which can be found below.
5
6
7## Example Plugin
8For the following example we are going to be creating a simple widget that couts how many seconds the status blocks have been running.
9```no_run
10
11use redblocks::Update;
12
13use std::fmt::{self, Display};
14
15struct Counter(u64);
16
17impl Counter {
18
19    fn new() -> Box<Self> {
20        Box::new(Self(0))
21    }
22
23}
24
25impl Display for Counter {
26
27    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
28        write!(f, "{}", self.0)
29    }
30}
31
32impl Update for Counter {
33
34    fn refresh(&mut self) {
35        self.0 = self.0 + 1;
36    }
37}
38
39```
40*/
41
42
43
44#[doc(inline)]
45pub use chrono::format::strftime;
46
47#[doc(hidden)]
48pub mod battery;
49#[doc(inline)]
50pub use self::battery::*;
51
52#[doc(hidden)]
53pub mod  cpu;
54#[doc(inline)]
55pub use self::cpu::*;
56
57#[doc(hidden)]
58pub mod mem;
59#[doc(inline)]
60pub use self::mem::*;
61
62#[doc(hidden)]
63pub mod time;
64#[doc(inline)] 
65pub use self::time::*;
66
67
68
69
70#[cfg(feature = "weather")]
71#[doc(hidden)]
72pub mod weather;
73#[cfg(feature = "weather")]
74#[doc(inline)]
75pub use self::weather::*;