Spec-Zone.ru › Tokio

Function ctrl_logoff

pub fn ctrl_logoff() -> Result<CtrlLogoff>
Available on Windows and crate feature signal only.

Creates a new listener which receives “ctrl-logoff” notifications sent to the process.

Examples

use tokio::signal::windows::ctrl_logoff;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // A listener of CTRL-LOGOFF events.
    let mut signal = ctrl_logoff()?;

    signal.recv().await;
    println!("got CTRL-LOGOFF. Cleaning up before exiting");

    Ok(())
}

MIT License
Copyright © Tokio Contributors
https://docs.rs/tokio/1.53.1/tokio/signal/windows/fn.ctrl_logoff.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API