#windows #async-executor #async #api

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

#1828 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

~153MB
~2.5M SLoC