summaryrefslogtreecommitdiffstats
path: root/vendor/windows-sys/readme.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:21 +0000
commit4e8199b572f2035b7749cba276ece3a26630d23e (patch)
treef09feeed6a0fe39d027b1908aa63ea6b35e4b631 /vendor/windows-sys/readme.md
parentAdding upstream version 1.66.0+dfsg1. (diff)
downloadrustc-4e8199b572f2035b7749cba276ece3a26630d23e.tar.xz
rustc-4e8199b572f2035b7749cba276ece3a26630d23e.zip
Adding upstream version 1.67.1+dfsg1.upstream/1.67.1+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/windows-sys/readme.md')
-rw-r--r--vendor/windows-sys/readme.md24
1 files changed, 11 insertions, 13 deletions
diff --git a/vendor/windows-sys/readme.md b/vendor/windows-sys/readme.md
index 3ea73c2c2..f4d62243d 100644
--- a/vendor/windows-sys/readme.md
+++ b/vendor/windows-sys/readme.md
@@ -1,9 +1,6 @@
-[![crates.io](https://img.shields.io/crates/v/windows.svg)](https://crates.io/crates/windows)
-[![build](https://github.com/microsoft/windows-rs/workflows/build/badge.svg?event=push)](https://github.com/microsoft/windows-rs/actions)
-
## Rust for Windows
-The `windows` crate lets you call any Windows API past, present, and future using code generated on the fly directly from the metadata describing the API and right into your Rust package where you can call them as if they were just another Rust module. The Rust language projection follows in the tradition established by [C++/WinRT](https://github.com/microsoft/cppwinrt) of building language projections for Windows using standard languages and compilers, providing a natural and idiomatic way for Rust developers to call Windows APIs.
+The `windows` and `windows-sys` crates let you call any Windows API past, present, and future using code generated on the fly directly from the [metadata describing the API](https://github.com/microsoft/windows-rs/tree/master/crates/libs/metadata/default) and right into your Rust package where you can call them as if they were just another Rust module. The Rust language projection follows in the tradition established by [C++/WinRT](https://github.com/microsoft/cppwinrt) of building language projections for Windows using standard languages and compilers, providing a natural and idiomatic way for Rust developers to call Windows APIs.
* Crate documentation
* [windows](https://microsoft.github.io/windows-docs-rs/)
@@ -16,9 +13,8 @@ Start by adding the following to your Cargo.toml file:
```toml
[dependencies.windows]
-version = "0.36.1"
+version = "0.42.0"
features = [
- "alloc",
"Data_Xml_Dom",
"Win32_Foundation",
"Win32_Security",
@@ -37,19 +33,20 @@ use windows::{
fn main() -> Result<()> {
let doc = XmlDocument::new()?;
- doc.LoadXml("<html>hello world</html>")?;
+ doc.LoadXml(w!("<html>hello world</html>"))?;
let root = doc.DocumentElement()?;
assert!(root.NodeName()? == "html");
assert!(root.InnerText()? == "hello world");
unsafe {
- let event = CreateEventW(std::ptr::null(), true, false, None)?;
+ let event = CreateEventW(None, true, false, None)?;
SetEvent(event).ok()?;
WaitForSingleObject(event, 0);
CloseHandle(event).ok()?;
- MessageBoxA(None, "Text", "Caption", MB_OK);
+ MessageBoxA(None, s!("Ansi"), s!("Caption"), MB_OK);
+ MessageBoxW(None, w!("Wide"), w!("Caption"), MB_OK);
}
Ok(())
@@ -64,8 +61,8 @@ Start by adding the following to your Cargo.toml file:
```toml
[dependencies.windows-sys]
-version = "0.36.1"
-features = [
+version = "0.42.0"
+6features = [
"Win32_Foundation",
"Win32_Security",
"Win32_System_Threading",
@@ -77,7 +74,7 @@ Make use of any Windows APIs as needed.
```rust
use windows_sys::{
- Win32::Foundation::*, Win32::System::Threading::*, Win32::UI::WindowsAndMessaging::*,
+ core::*, Win32::Foundation::*, Win32::System::Threading::*, Win32::UI::WindowsAndMessaging::*,
};
fn main() {
@@ -87,7 +84,8 @@ fn main() {
WaitForSingleObject(event, 0);
CloseHandle(event);
- MessageBoxA(0, b"Text\0".as_ptr(), b"Caption\0".as_ptr(), MB_OK);
+ MessageBoxA(0, s!("Ansi"), s!("Caption"), MB_OK);
+ MessageBoxW(0, w!("Wide"), w!("Caption"), MB_OK);
}
}
```