pub struct NetworkSpeedWidget { /* private fields */ }
Expand description
A widget that shows the network speed realtimely
Implementations§
Source§impl NetworkSpeedWidget
impl NetworkSpeedWidget
Sourcepub fn new(interface: &str) -> Self
pub fn new(interface: &str) -> Self
Create the widget, for given interface.
interface The interface to monitor
Examples found in repository?
examples/sample-i3-bar/main.rs (line 14)
4fn main() {
5 let mut bar = WidgetCollection::new();
6
7 //Add realtime stock prices, for example: Microsoft, AMD and Facebook
8 let stock_client = StockClient::new("your-alphavantage-API-key");
9 bar.push(StockClient::create_widget(&stock_client, "MSFT"));
10 bar.push(StockClient::create_widget(&stock_client, "AMD"));
11 bar.push(StockClient::create_widget(&stock_client, "FB"));
12
13 //Realtime upload/download rate for a interface
14 bar.push(NetworkSpeedWidget::new("wlp58s0"));
15
16 //Display all the cpu usage for each core
17 for i in 0..4 {
18 bar.push(CpuWidget::new(i));
19 }
20
21 //Volume widget
22 bar.push(VolumeWidget::new("default", "Master", 0));
23
24 //Battery status
25 bar.push(BatteryWidget::new(0));
26
27 //Time
28 bar.push(DateTimeWidget::new());
29
30 // Then start updating the satus bar
31 bar.update_loop(I3Protocol::new(Header::new(1), std::io::stdout()));
32}
Trait Implementations§
Source§impl Widget for NetworkSpeedWidget
impl Widget for NetworkSpeedWidget
Auto Trait Implementations§
impl Freeze for NetworkSpeedWidget
impl RefUnwindSafe for NetworkSpeedWidget
impl Send for NetworkSpeedWidget
impl Sync for NetworkSpeedWidget
impl Unpin for NetworkSpeedWidget
impl UnwindSafe for NetworkSpeedWidget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more