Skip to main content

tasklist

Function tasklist 

Source
pub fn tasklist() -> Result<Tasklist, String>
Expand description

Retrieves a snapshot of all running processes in the system.

This function creates a snapshot of all processes using the Windows ToolHelp API. If successful, it returns a Tasklist struct containing process information. If any error occurs during snapshot creation or process enumeration, it returns an error message as a string.

§Examples

use tasklist;
match tasklist::tasklist() {
    Ok(tasklist) => println!("{:?}", tasklist),
    Err(e) => eprintln!("Error: {}", e),
}

§Returns

  • Ok(Tasklist): A Tasklist iterator containing process information
  • Err(String): An error message indicating the reason for the failure