#signals #across #emitting #channel #station #enums #false

radiowave

整个程序中发射信号的库

5 个版本 (2 个稳定版)

2.0.0 2023 年 12 月 9 日
1.0.0 2023 年 10 月 21 日
0.1.2 2023 年 10 月 19 日
0.1.1 2023 年 10 月 19 日
0.1.0 2023 年 10 月 19 日

#3#false

每月下载 49

MIT 许可证

6KB
65

RadioWave

用于整个程序中发射信号的 Rust 包。

示例

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);
}

无运行时依赖