5次发布
0.2.0 | 2021年6月23日 |
---|---|
0.1.3 | 2020年4月14日 |
0.1.2 | 2019年9月19日 |
0.1.1 | 2019年9月19日 |
0.1.0 | 2019年9月17日 |
#971 in Unix API
每月36次下载
12KB
216 行代码(不含注释)
通知服务管理器启动完成和其他守护进程状态变化。
先决条件
需要带有Notify
服务类型的单元文件。
示例
[Unit]
Description=Frobulator
[Service]
Type=notify
ExecStart=/usr/sbin/frobulator
[Install]
WantedBy=multi-user.target
同步API
use sdnotify::{SdNotify, Message, Error};
let notifier = SdNotify::from_env()?;
notifier.notify_ready()?;
异步API
use sdnotify::{Message, Error, async_io::SdNotify};
use tokio::prelude::*;
use tokio::runtime::current_thread::Runtime;
let notifier = SdNotify::from_env()?;
let mut rt = Runtime::new().unwrap();
rt.block_on(notifier.send(Message::ready())).unwrap();
依赖
~0–8.5MB
~68K SLoC