Crates.io | radiowave |
lib.rs | radiowave |
version | 2.0.0 |
source | src |
created_at | 2023-10-19 01:22:24.425862 |
updated_at | 2023-12-09 21:13:59.013034 |
description | A library for emitting signals across the entire program. |
homepage | |
repository | https://gitlab.com/oglo-crates/radiowave |
max_upload_size | |
id | 1007380 |
size | 6,455 |
A Rust crate for emitting signals across the entire program.
use radiowave::*;
enum Channel {
AppEvents = 0,
}
fn main() {
let station = RadioStation::new(Channel::AppEvents as usize);
if station.signal_exists("saycow") == false {
println!("Hmmmm... let us say moooooo!");
station.send_signal("saycow", "Mooooo! Says the cow.").unwrap(); // This statement fails if the signal already exists.
}
else {
println!("Cancelling signal!");
station.cancel_signal_if_exists("saycow");
}
}
fn moo() {
let station = RadioStation::new(Channel::AppEvents as usize);
let what_does_the_cow_say: String = station.wait_for_signal("saycow");
println!("The cow says: {}", what_does_the_cow_say);
}