Crate anybar [−] [src]
This is a small crate for the AnyBar.
Examples
The functioning of this crate is pretty simple. These are the most use cases:
Using the default port
// create a new AnyBar instance connected to the default port let mut bar = Anybar::default(); // set the color bar.set_color(Color::Red).unwrap();
Using a separate port
// Anybar::new() takes the Anybar port as parameter let mut custom_bar = Anybar::new(1708); custom_bar.set_color(Color::Exclamation).unwrap();
Additional information
let mut bar = Anybar::default(); // after instantiation, the last color is None assert!(bar.color.is_none()); bar.set_color(Color::Red).unwrap(); // the last color now contains a value // assert_eq!(bar.color.unwrap(), Color::Red);
Note that the value of bar.color
does not necessarily represent the real color
displayed at the moment, depending on whether you have something or someone else messing
with your AnyBar simultaneously.
Note
The AnyBar itself does not provide any information on whether the sent command was executed successfully, so the lib will only return an error if it was not able to bind a UDP socket.
Structs
Anybar |
The Anybar handle. |
Enums
Color |
The different colors supported by AnyBar. |