#windows #async-executor #async

windows-async

Simple async executor for windows application using windows crate

4 releases

0.2.1 Mar 11, 2022
0.2.0 Mar 11, 2022
0.1.1 Mar 11, 2022
0.1.0 Mar 11, 2022

#1996 in Asynchronous

MIT license

11KB
171 lines

windows-async-rs

Simple async executor for windows application using windows crate.

Example

// Show Desktop App list example (using WinRT "Windows.Inventory.InstalledDesktopApp")
use windows::core::{
    Result,
};

use windows::System::Inventory::{
    InstalledDesktopApp,
};

async fn show_installed_desktop_app() -> Result<()> {

    let vec = InstalledDesktopApp::GetInventoryAsync()?.await?;

    for i in 0..vec.Size()? {
        let item = vec.GetAt(i)?;
        println!("Id: {:?}", item.Id()?);
        println!("DisplayName: {:?}", item.DisplayName()?);
        println!("Publisher: {:?}", item.Publisher()?);
        println!("DisplayVersion: {:?}", item.DisplayVersion()?);
        println!();
    }

    Ok(())
}

fn main() {
    if let Err(e) = windows_async::block_on(show_installed_desktop_app()) {
        println!("error: {:?}", e);
    }
}

lib.rs:

Simple async executor for windows application using windows crate.

Examples

// Show Desktop App list example (using WinRT "Windows.Inventory.InstalledDesktopApp")

use windows::core::{
    Result,
};

use windows::System::Inventory::{
    InstalledDesktopApp,
};

async fn show_installed_desktop_app() -> Result<()> {

    let vec = InstalledDesktopApp::GetInventoryAsync()?.await?;

    for i in 0..vec.Size()? {
        let item = vec.GetAt(i)?;
        println!("Id: {:?}", item.Id()?);
        println!("DisplayName: {:?}", item.DisplayName()?);
        println!("Publisher: {:?}", item.Publisher()?);
        println!("DisplayVersion: {:?}", item.DisplayVersion()?);
        println!();
    }

    Ok(())
}

fn main() {
    if let Err(e) = windows_async::block_on(show_installed_desktop_app()) {
        println!("error: {:?}", e);
    }
}

Dependencies

~129MB
~2M SLoC