From f41633bab690f133314b48cdb8f2ef48792dfd47 Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Thu, 25 Apr 2024 13:27:22 -0700 Subject: [PATCH] refactor: use a standardized workspace lint table --- .github/workflows/docs.yaml | 3 ++ .../workflows/github-dependency-review.yaml | 3 +- Cargo.toml | 32 +++++++++++++++++ Makefile.toml | 1 + crates/sample-kmdf-driver/Cargo.toml | 3 ++ crates/sample-kmdf-driver/build.rs | 2 ++ crates/sample-kmdf-driver/src/lib.rs | 13 +++---- crates/wdk-alloc/Cargo.toml | 3 ++ crates/wdk-alloc/src/lib.rs | 18 ---------- crates/wdk-build/Cargo.toml | 35 +++++++++++++++++++ crates/wdk-build/build.rs | 2 ++ crates/wdk-build/src/lib.rs | 22 +----------- crates/wdk-macros/Cargo.toml | 33 +++++++++++++++++ crates/wdk-macros/src/lib.rs | 18 ---------- crates/wdk-panic/Cargo.toml | 3 ++ crates/wdk-panic/src/lib.rs | 19 +--------- crates/wdk-sys/Cargo.toml | 35 +++++++++++++++++++ crates/wdk-sys/build.rs | 2 ++ crates/wdk-sys/src/lib.rs | 18 ---------- crates/wdk/Cargo.toml | 3 ++ crates/wdk/build.rs | 2 ++ crates/wdk/src/lib.rs | 19 +--------- crates/wdk/src/wdf/spinlock.rs | 3 -- crates/wdk/src/wdf/timer.rs | 3 -- 24 files changed, 169 insertions(+), 126 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 7abf0af8..f55139cc 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -7,6 +7,9 @@ on: name: Docs +env: + RUSTDOCFLAGS: -D warnings + jobs: docs: name: Docs diff --git a/.github/workflows/github-dependency-review.yaml b/.github/workflows/github-dependency-review.yaml index 8f5fd1e4..15d600bc 100644 --- a/.github/workflows/github-dependency-review.yaml +++ b/.github/workflows/github-dependency-review.yaml @@ -20,7 +20,8 @@ jobs: uses: actions/dependency-review-action@v4 with: # AND combinations are currently bugged and must be listed separately: https://github.com/actions/dependency-review-action/issues/263 - allow-licenses: MIT, Apache-2.0, BSD-3-Clause, ISC, Unicode-DFS-2016, (MIT OR Apache-2.0) AND Unicode-DFS-2016 + # OR combinations are currently bugged and must be listed separately: https://github.com/actions/dependency-review-action/issues/670 + allow-licenses: MIT, Apache-2.0, BSD-3-Clause, ISC, Unicode-DFS-2016, (MIT OR Apache-2.0) AND Unicode-DFS-2016, Unlicense OR MIT # anstyle is licensed as (MIT OR Apache-2.0), but the Github api fails to detect it: https://github.com/rust-cli/anstyle/tree/main/crates/anstyle allow-dependencies-licenses: 'pkg:cargo/anstyle@1.0.4' comment-summary-in-pr: on-failure diff --git a/Cargo.toml b/Cargo.toml index 46ee3db2..2d943df5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,3 +26,35 @@ wdk-sys = { path = "crates/wdk-sys", version = "0.2.0" } bindgen = "0.69.4" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" + +# Until https://github.com/rust-lang/cargo/issues/12208 is resolved, each package in the workspace needs to explictly +# add the following block to its Cargo manifest in order to enable these global lint configurations: +# +# [lints] +# workspace = true + +[workspace.lints.rust] +missing_docs = "warn" +unsafe_op_in_unsafe_fn = "forbid" + +[workspace.lints.clippy] +# Lint Groups +all = "deny" +pedantic = "warn" +nursery = "warn" +cargo = "warn" +# Individual Lints +multiple_unsafe_ops_per_block = "forbid" +undocumented_unsafe_blocks = "forbid" +unnecessary_safety_doc = "forbid" + +[workspace.lints.rustdoc] +bare_urls = "warn" +broken_intra_doc_links = "warn" +invalid_codeblock_attributes = "warn" +invalid_html_tags = "warn" +invalid_rust_codeblocks = "warn" +missing_crate_level_docs = "warn" +private_intra_doc_links = "warn" +redundant_explicit_links = "warn" +unescaped_backticks = "warn" diff --git a/Makefile.toml b/Makefile.toml index 2481dfd7..a749b193 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -9,6 +9,7 @@ CARGO_MAKE_SKIP_SLOW_SECONDARY_FLOWS = false CARGO_MAKE_CLIPPY_ARGS = "--all-targets -- -D warnings" RUSTFLAGS = "-D warnings" CARGO_MAKE_RUST_DEFAULT_TOOLCHAIN = "stable" +RUSTDOCFLAGS = "-D warnings" [tasks.wdk-pre-commit-flow] description = "Run pre-commit tasks and checks" diff --git a/crates/sample-kmdf-driver/Cargo.toml b/crates/sample-kmdf-driver/Cargo.toml index db34dc3e..f3ad3670 100644 --- a/crates/sample-kmdf-driver/Cargo.toml +++ b/crates/sample-kmdf-driver/Cargo.toml @@ -32,3 +32,6 @@ wdk-build.workspace = true [features] default = [] nightly = ["wdk-macros/nightly", "wdk/nightly", "wdk-sys/nightly"] + +[lints] +workspace = true diff --git a/crates/sample-kmdf-driver/build.rs b/crates/sample-kmdf-driver/build.rs index 413ff081..ae538bcf 100644 --- a/crates/sample-kmdf-driver/build.rs +++ b/crates/sample-kmdf-driver/build.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation // License: MIT OR Apache-2.0 +//! Build script for the `sample-kmdf-driver` crate. + fn main() -> Result<(), wdk_build::ConfigError> { wdk_build::Config::from_env_auto()?.configure_binary_build() } diff --git a/crates/sample-kmdf-driver/src/lib.rs b/crates/sample-kmdf-driver/src/lib.rs index f420de0d..9bf39dc0 100644 --- a/crates/sample-kmdf-driver/src/lib.rs +++ b/crates/sample-kmdf-driver/src/lib.rs @@ -1,15 +1,12 @@ // Copyright (c) Microsoft Corporation // License: MIT OR Apache-2.0 +//! # Sample KMDF Driver +//! +//! This is a sample KMDF driver that demonstrates how to use the crates in +//! windows-driver-rs to create a skeleton of a kmdf driver. + #![no_std] -#![deny(unsafe_op_in_unsafe_fn)] -#![deny(clippy::all)] -#![deny(clippy::pedantic)] -#![deny(clippy::nursery)] -#![deny(clippy::cargo)] -#![deny(clippy::undocumented_unsafe_blocks)] -#![deny(clippy::unnecessary_safety_doc)] -#![deny(clippy::multiple_unsafe_ops_per_block)] extern crate alloc; diff --git a/crates/wdk-alloc/Cargo.toml b/crates/wdk-alloc/Cargo.toml index 8cb74007..be916ed2 100644 --- a/crates/wdk-alloc/Cargo.toml +++ b/crates/wdk-alloc/Cargo.toml @@ -14,3 +14,6 @@ wdk-sys.workspace = true [dev-dependencies] wdk-sys = { workspace = true, features = ["test-stubs"] } + +[lints] +workspace = true diff --git a/crates/wdk-alloc/src/lib.rs b/crates/wdk-alloc/src/lib.rs index cf16f3fd..f1ea185f 100644 --- a/crates/wdk-alloc/src/lib.rs +++ b/crates/wdk-alloc/src/lib.rs @@ -15,24 +15,6 @@ //! ``` #![no_std] -#![deny(missing_docs)] -#![deny(unsafe_op_in_unsafe_fn)] -#![deny(clippy::all)] -#![deny(clippy::pedantic)] -#![deny(clippy::nursery)] -#![deny(clippy::cargo)] -#![deny(clippy::multiple_unsafe_ops_per_block)] -#![deny(clippy::undocumented_unsafe_blocks)] -#![deny(clippy::unnecessary_safety_doc)] -#![deny(rustdoc::broken_intra_doc_links)] -#![deny(rustdoc::private_intra_doc_links)] -#![deny(rustdoc::missing_crate_level_docs)] -#![deny(rustdoc::invalid_codeblock_attributes)] -#![deny(rustdoc::invalid_html_tags)] -#![deny(rustdoc::invalid_rust_codeblocks)] -#![deny(rustdoc::bare_urls)] -#![deny(rustdoc::unescaped_backticks)] -#![deny(rustdoc::redundant_explicit_links)] use core::alloc::{GlobalAlloc, Layout}; diff --git a/crates/wdk-build/Cargo.toml b/crates/wdk-build/Cargo.toml index d0f0f6b2..089d63ec 100644 --- a/crates/wdk-build/Cargo.toml +++ b/crates/wdk-build/Cargo.toml @@ -27,3 +27,38 @@ rustversion = "1.0.14" [dev-dependencies] windows = { version = "0.52.0", features = ["Win32_UI_Shell"] } + +# Cannot inherit workspace lints since overriding them is not supported yet: https://github.com/rust-lang/cargo/issues/13157 +# [lints] +# workspace = true +# +# Differences from the workspace lints have comments explaining why they are different + +[lints.rust] +missing_docs = "warn" +unsafe_op_in_unsafe_fn = "forbid" + +[lints.clippy] +# Lint Groups +all = "deny" +pedantic = "warn" +nursery = "warn" +cargo = "warn" +# Individual Lints +# multiple_unsafe_ops_per_block = "forbid" +multiple_unsafe_ops_per_block = "deny" # This is lowered to deny since clap generates allow(clippy::restriction) in its Parser and Args derive macros +# undocumented_unsafe_blocks = "forbid" +undocumented_unsafe_blocks = "deny" # This is lowered to deny since clap generates allow(clippy::restriction) in its Parser and Args derive macros +# unnecessary_safety_doc = "forbid" +unnecessary_safety_doc = "deny" # This is lowered to deny since clap generates allow(clippy::restriction) in its Parser and Args derive macros + +[lints.rustdoc] +bare_urls = "warn" +broken_intra_doc_links = "warn" +invalid_codeblock_attributes = "warn" +invalid_html_tags = "warn" +invalid_rust_codeblocks = "warn" +missing_crate_level_docs = "warn" +private_intra_doc_links = "warn" +redundant_explicit_links = "warn" +unescaped_backticks = "warn" diff --git a/crates/wdk-build/build.rs b/crates/wdk-build/build.rs index fcd4d21f..e3fe87de 100644 --- a/crates/wdk-build/build.rs +++ b/crates/wdk-build/build.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation // License: MIT OR Apache-2.0 +//! Build script for the `wdk-build` crate. + #[rustversion::nightly] fn main() { println!("cargo:rustc-cfg=nightly_toolchain"); diff --git a/crates/wdk-build/src/lib.rs b/crates/wdk-build/src/lib.rs index 5d9b2438..56f89eb8 100644 --- a/crates/wdk-build/src/lib.rs +++ b/crates/wdk-build/src/lib.rs @@ -9,28 +9,8 @@ //! well strives to allow for all the configuration the WDK allows. This //! includes being ables to select different WDF versions and different driver //! models (WDM, KMDF, UMDF). + #![cfg_attr(nightly_toolchain, feature(assert_matches))] -#![deny(missing_docs)] -#![deny(unsafe_op_in_unsafe_fn)] -#![deny(clippy::all)] -#![deny(clippy::pedantic)] -#![deny(clippy::nursery)] -#![deny(clippy::cargo)] -// `wdk-build` is only to be used in build scripts, so binary bloat from multiple depenedency -// versions is not a concern -#![allow(clippy::multiple_crate_versions)] -#![deny(clippy::multiple_unsafe_ops_per_block)] -#![deny(clippy::undocumented_unsafe_blocks)] -#![deny(clippy::unnecessary_safety_doc)] -#![deny(rustdoc::broken_intra_doc_links)] -#![deny(rustdoc::private_intra_doc_links)] -#![deny(rustdoc::missing_crate_level_docs)] -#![deny(rustdoc::invalid_codeblock_attributes)] -#![deny(rustdoc::invalid_html_tags)] -#![deny(rustdoc::invalid_rust_codeblocks)] -#![deny(rustdoc::bare_urls)] -#![deny(rustdoc::unescaped_backticks)] -#![deny(rustdoc::redundant_explicit_links)] mod bindgen; mod utils; diff --git a/crates/wdk-macros/Cargo.toml b/crates/wdk-macros/Cargo.toml index 41e3c48d..14a6dcbe 100644 --- a/crates/wdk-macros/Cargo.toml +++ b/crates/wdk-macros/Cargo.toml @@ -48,3 +48,36 @@ development = [ [features] default = [] nightly = [] + +# Cannot inherit workspace lints since overriding them is not supported yet: https://github.com/rust-lang/cargo/issues/13157 +# [lints] +# workspace = true +# +# Differences from the workspace lints have comments explaining why they are different + +[lints.rust] +missing_docs = "warn" +unsafe_op_in_unsafe_fn = "forbid" + +[lints.clippy] +# Lint Groups +all = "deny" +pedantic = "warn" +nursery = "warn" +cargo = "warn" +# Individual Lints +multiple_unsafe_ops_per_block = "forbid" +undocumented_unsafe_blocks = "forbid" +# unnecessary_safety_doc = "forbid" +unnecessary_safety_doc = "deny" # This is lowered to deny to allow overriding it for proc_macros: https://github.com/rust-lang/rust-clippy/issues/12583 + +[lints.rustdoc] +bare_urls = "warn" +broken_intra_doc_links = "warn" +invalid_codeblock_attributes = "warn" +invalid_html_tags = "warn" +invalid_rust_codeblocks = "warn" +missing_crate_level_docs = "warn" +private_intra_doc_links = "warn" +redundant_explicit_links = "warn" +unescaped_backticks = "warn" diff --git a/crates/wdk-macros/src/lib.rs b/crates/wdk-macros/src/lib.rs index 36a826fc..6ad1600a 100644 --- a/crates/wdk-macros/src/lib.rs +++ b/crates/wdk-macros/src/lib.rs @@ -3,24 +3,6 @@ //! A collection of macros that help make it easier to interact with //! [`wdk-sys`]'s direct bindings to the Windows Driver Kit (WDK). -#![deny(missing_docs)] -#![deny(unsafe_op_in_unsafe_fn)] -#![deny(clippy::all)] -#![deny(clippy::pedantic)] -#![deny(clippy::nursery)] -#![deny(clippy::cargo)] -#![deny(clippy::multiple_unsafe_ops_per_block)] -#![deny(clippy::undocumented_unsafe_blocks)] -#![deny(clippy::unnecessary_safety_doc)] -#![deny(rustdoc::broken_intra_doc_links)] -#![deny(rustdoc::private_intra_doc_links)] -#![deny(rustdoc::missing_crate_level_docs)] -#![deny(rustdoc::invalid_codeblock_attributes)] -#![deny(rustdoc::invalid_html_tags)] -#![deny(rustdoc::invalid_rust_codeblocks)] -#![deny(rustdoc::bare_urls)] -#![deny(rustdoc::unescaped_backticks)] -#![deny(rustdoc::redundant_explicit_links)] use std::{ io::{BufReader, Read}, diff --git a/crates/wdk-panic/Cargo.toml b/crates/wdk-panic/Cargo.toml index 8b593a21..10062aef 100644 --- a/crates/wdk-panic/Cargo.toml +++ b/crates/wdk-panic/Cargo.toml @@ -8,3 +8,6 @@ readme.workspace = true license.workspace = true keywords = ["panic-handler", "panic", "panic-impl", "wdk", "windows"] categories = ["no-std", "hardware-support"] + +[lints] +workspace = true diff --git a/crates/wdk-panic/src/lib.rs b/crates/wdk-panic/src/lib.rs index 1ef667fb..df6c5738 100644 --- a/crates/wdk-panic/src/lib.rs +++ b/crates/wdk-panic/src/lib.rs @@ -2,25 +2,8 @@ // License: MIT OR Apache-2.0 //! Default Panic Handlers for programs built with the WDK (Windows Drivers Kit) + #![no_std] -#![deny(missing_docs)] -#![deny(unsafe_op_in_unsafe_fn)] -#![deny(clippy::all)] -#![deny(clippy::pedantic)] -#![deny(clippy::nursery)] -#![deny(clippy::cargo)] -#![deny(clippy::multiple_unsafe_ops_per_block)] -#![deny(clippy::undocumented_unsafe_blocks)] -#![deny(clippy::unnecessary_safety_doc)] -#![deny(rustdoc::broken_intra_doc_links)] -#![deny(rustdoc::private_intra_doc_links)] -#![deny(rustdoc::missing_crate_level_docs)] -#![deny(rustdoc::invalid_codeblock_attributes)] -#![deny(rustdoc::invalid_html_tags)] -#![deny(rustdoc::invalid_rust_codeblocks)] -#![deny(rustdoc::bare_urls)] -#![deny(rustdoc::unescaped_backticks)] -#![deny(rustdoc::redundant_explicit_links)] #[cfg(not(test))] use core::panic::PanicInfo; diff --git a/crates/wdk-sys/Cargo.toml b/crates/wdk-sys/Cargo.toml index f6792c2d..10acc240 100644 --- a/crates/wdk-sys/Cargo.toml +++ b/crates/wdk-sys/Cargo.toml @@ -32,3 +32,38 @@ rustversion = "1.0.14" default = [] nightly = ["wdk-macros/nightly"] test-stubs = [] + +# Cannot inherit workspace lints since overriding them is not supported yet: https://github.com/rust-lang/cargo/issues/13157 +# [lints] +# workspace = true +# +# Differences from the workspace lints have comments explaining why they are different + +[lints.rust] +missing_docs = "warn" +# unsafe_op_in_unsafe_fn = "forbid" +unsafe_op_in_unsafe_fn = "deny" # This is lowered to deny so that we can opt out of it for generated code + +[lints.clippy] +# Lint Groups +all = "deny" +pedantic = "warn" +nursery = "warn" +cargo = "warn" +# Individual Lints +# multiple_unsafe_ops_per_block = "forbid" +multiple_unsafe_ops_per_block = "deny" # This is lowered to deny so that we can opt out of it for generated code +# undocumented_unsafe_blocks = "forbid" +undocumented_unsafe_blocks = "deny" # This is lowered to deny so that we can opt out of it for generated code +unnecessary_safety_doc = "forbid" + +[lints.rustdoc] +bare_urls = "warn" +broken_intra_doc_links = "warn" +invalid_codeblock_attributes = "warn" +invalid_html_tags = "warn" +invalid_rust_codeblocks = "warn" +missing_crate_level_docs = "warn" +private_intra_doc_links = "warn" +redundant_explicit_links = "warn" +unescaped_backticks = "warn" diff --git a/crates/wdk-sys/build.rs b/crates/wdk-sys/build.rs index c1e07fd6..efb569ab 100644 --- a/crates/wdk-sys/build.rs +++ b/crates/wdk-sys/build.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation // License: MIT OR Apache-2.0 +//! Build script for the `wdk-sys` crate. + use std::{ env, path::{Path, PathBuf}, diff --git a/crates/wdk-sys/src/lib.rs b/crates/wdk-sys/src/lib.rs index c9e35547..63844a3e 100644 --- a/crates/wdk-sys/src/lib.rs +++ b/crates/wdk-sys/src/lib.rs @@ -4,24 +4,6 @@ //! Direct bindings to APIs available in the Windows Development Kit (WDK) #![no_std] -#![deny(missing_docs)] -#![deny(unsafe_op_in_unsafe_fn)] -#![deny(clippy::all)] -#![deny(clippy::pedantic)] -#![deny(clippy::nursery)] -#![deny(clippy::cargo)] -#![deny(clippy::multiple_unsafe_ops_per_block)] -#![deny(clippy::undocumented_unsafe_blocks)] -#![deny(clippy::unnecessary_safety_doc)] -#![deny(rustdoc::broken_intra_doc_links)] -#![deny(rustdoc::private_intra_doc_links)] -#![deny(rustdoc::missing_crate_level_docs)] -#![deny(rustdoc::invalid_codeblock_attributes)] -#![deny(rustdoc::invalid_html_tags)] -#![deny(rustdoc::invalid_rust_codeblocks)] -#![deny(rustdoc::bare_urls)] -#![deny(rustdoc::unescaped_backticks)] -#![deny(rustdoc::redundant_explicit_links)] mod constants; mod types; diff --git a/crates/wdk/Cargo.toml b/crates/wdk/Cargo.toml index 6bd0ed2d..4679bb51 100644 --- a/crates/wdk/Cargo.toml +++ b/crates/wdk/Cargo.toml @@ -29,3 +29,6 @@ wdk-sys = { workspace = true, features = ["test-stubs"] } default = ["alloc"] alloc = [] nightly = ["wdk-sys/nightly"] + +[lints] +workspace = true diff --git a/crates/wdk/build.rs b/crates/wdk/build.rs index 3a375ad7..c05a3eca 100644 --- a/crates/wdk/build.rs +++ b/crates/wdk/build.rs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation // License: MIT OR Apache-2.0 +//! Build script for the `wdk` crate. + fn main() -> Result<(), wdk_build::ConfigError> { // Re-export config from wdk-sys Ok(wdk_build::Config::from_env_auto()?.export_config()?) diff --git a/crates/wdk/src/lib.rs b/crates/wdk/src/lib.rs index 75139152..ad490dc3 100644 --- a/crates/wdk/src/lib.rs +++ b/crates/wdk/src/lib.rs @@ -4,25 +4,8 @@ //! Idiomatic Rust wrappers for the Windows Driver Kit (WDK) APIs. This crate is //! built on top of the raw FFI bindings provided by [`wdk-sys`], and provides a //! safe, idiomatic rust interface to the WDK. + #![no_std] -#![deny(missing_docs)] -#![deny(unsafe_op_in_unsafe_fn)] -#![deny(clippy::all)] -#![deny(clippy::pedantic)] -#![deny(clippy::nursery)] -#![deny(clippy::cargo)] -#![deny(clippy::multiple_unsafe_ops_per_block)] -#![deny(clippy::undocumented_unsafe_blocks)] -#![deny(clippy::unnecessary_safety_doc)] -#![deny(rustdoc::broken_intra_doc_links)] -#![deny(rustdoc::private_intra_doc_links)] -#![deny(rustdoc::missing_crate_level_docs)] -#![deny(rustdoc::invalid_codeblock_attributes)] -#![deny(rustdoc::invalid_html_tags)] -#![deny(rustdoc::invalid_rust_codeblocks)] -#![deny(rustdoc::bare_urls)] -#![deny(rustdoc::unescaped_backticks)] -#![deny(rustdoc::redundant_explicit_links)] #[cfg(feature = "alloc")] mod print; diff --git a/crates/wdk/src/wdf/spinlock.rs b/crates/wdk/src/wdf/spinlock.rs index aaae3016..ad0ffb0f 100644 --- a/crates/wdk/src/wdf/spinlock.rs +++ b/crates/wdk/src/wdf/spinlock.rs @@ -2,9 +2,6 @@ use wdk_sys::{macros, NTSTATUS, WDFSPINLOCK, WDF_OBJECT_ATTRIBUTES}; use crate::nt_success; -// private module + public re-export avoids the module name repetition: https://github.com/rust-lang/rust-clippy/issues/8524 -#[allow(clippy::module_name_repetitions)] - /// WDF Spin Lock. /// /// Use framework spin locks to synchronize access to driver data from code that diff --git a/crates/wdk/src/wdf/timer.rs b/crates/wdk/src/wdf/timer.rs index b9012c85..4a6cc5ea 100644 --- a/crates/wdk/src/wdf/timer.rs +++ b/crates/wdk/src/wdf/timer.rs @@ -2,9 +2,6 @@ use wdk_sys::{macros, NTSTATUS, WDFTIMER, WDF_OBJECT_ATTRIBUTES, WDF_TIMER_CONFI use crate::nt_success; -// private module + public re-export avoids the module name repetition: https://github.com/rust-lang/rust-clippy/issues/8524 -#[allow(clippy::module_name_repetitions)] - /// WDF Timer. pub struct Timer { wdf_timer: WDFTIMER,