2 个版本

使用旧的 Rust 2015

0.1.1 2019 年 2 月 15 日
0.1.0 2018 年 11 月 2 日

#4#logind

MIT 许可证

5KB

logind-dbus

logind-dbus 是一个 Rust crate,它提供了一个 DBus API,用于与 logind 交互,这对于执行抑制挂起等操作非常有用。

extern crate logind_dbus;
use logind_dbus::LoginManager;

pub fn main() -> io::Result<()> {
    let login_manager = LoginManager::new()?;
    let suspend_lock = login_manager.connect().inhibit_suspend()?;
    /// Do sensitive thing with the guarantee that suspend will not work.
}

lib.rs:

提供了一个 DBus API,用于与 logind 交互,这对于执行抑制挂起等操作非常有用。

extern crate logind_dbus;
use logind_dbus::LoginManager;

pub fn main() -> io::Result<()> {
    let login_manager = LoginManager::new()?;
    let suspend_lock = login_manager.connect().inhibit_suspend()?;
    /// Do sensitive thing with the guarantee that suspend will not work.
}

依赖项

~5MB
~114K SLoC