4 releases

Uses old Rust 2015

0.1.3 Sep 11, 2016
0.1.2 Sep 8, 2016
0.1.1 May 24, 2016
0.1.0 May 23, 2016

#118 in macOS and iOS APIs

MIT license

7KB
71 lines

anybar-rs

This is a small Rust Crate for AnyBar.

Build Status Crates.io

Examples

Connect using the default port

use anybar::*;

// create a new AnyBar instance connected to the default port
let mut bar = Anybar::default();

// set the color
bar.set_color(Color::Red).unwrap();

Connect using a separate port

use anybar::*;

// Anybar::new() takes the AnyBar port as parameter
let mut custom_bar = Anybar::new(1708);
custom_bar.set_color(Color::Exclamation).unwrap();

Usage & Documentation

Please check the documentation for more examples and details on certain functions.

License

This work is licensed under the MIT license. See LICENSE for more information.


lib.rs:

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.

No runtime deps