Function wmi::query::build_notification_query
source · pub fn build_notification_query<'de, T>(
filters: Option<&HashMap<String, FilterValue>>,
within: Option<Duration>
) -> WMIResult<String>where
T: Deserialize<'de>,
Expand description
Build an SQL query for an event notification subscription with the given filters and within polling time, over the given type (using its fields). For example, for:
§Examples
For a struct such as:
ⓘ
#[derive(Deserialize, Debug)]
#[serde(rename = "Win32_ProcessStartTrace")]
#[serde(rename_all = "PascalCase")]
struct ProcessStartTrace {
process_id: u32,
process_name: String,
}
The resulting query with no filters and no within polling time will look like:
"SELECT * FROM Win32_ProcessStartTrace";
Conversely, the resulting query with filters and with within polling time will look like:
"SELECT * FROM Win32_ProcessStartTrace WITHIN 10 WHERE ProcessName = 'explorer.exe'";