Step Into Rust · Lesson 13 · Systems Rust
Safe Wrappers for Win32
UTF-16 the std way, errors as Result with real messages, and handles that close themselves.
- ~40 minreading and coding
- 4missions
- membersaccess
- Win32real Windows API
Part of Step Into Rust. The full lesson, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.
In the Windows API lesson you called extern "system" functions directly. Real Rust code wraps each one once, so the rest of the program never touches a raw handle or an error code:
In this lesson
- The goal: unsafe at the edges only
- UTF-16, the standard library way
- Errors as values
- RAII handles
Missions
- UTF-16 the std way
- Errors that explain themselves
- A handle that closes itself
- Result all the way down