Struct anybar::Anybar
[−]
[src]
pub struct Anybar { pub port: u16, pub color: Option<Color>, }
The Anybar handle.
Fields
port: u16
The UDP Port the Anybar is connected to
color: Option<Color>
The last color that has been set.
When no color has been set yet, color is None
.
Methods
impl Anybar
[src]
fn new(port: u16) -> Anybar
Create a new Anybar instance, connected to the given UDP port.
port
may be any port between 0 and 6553.
Panics
Panics if the port has a non-valid value outside of the range between 0 and 6553.
Examples
let custom_bar = Anybar::new(1708); assert_eq!(custom_bar.port, 1708);
fn set_color(&mut self, color: Color) -> Result<(), Error>
Set a new color.
The function returns a ResultType
which will contain a std::io::Error
when the UDP socket can't be bound.
fn quit(self) -> Result<(), Error>
Sends the quit signal to the Anybar and takes ownership of the object.
This is an experimental feature of AnyBar. Since the AnyBar will quit during the
execution of this function, it takes the ownership of self
,
which will be dropped when this function returns.
The function returns a ResultType
which will contain a std::io::Error
when the UDP socket can't be bound.
Example
let mut bar = Anybar::default(); // do stuff... bar.quit().unwrap(); bar.set_color(Color::White).unwrap(); // this won't work, bar has been moved
Trait Implementations
impl Default for Anybar
[src]
Instanciates the default AnyBar, connected to the Port 1738
.
let bar = Anybar::default(); assert_eq!(bar.port, 1738);