Step Into Labs

Step Into Rust · Module exam · Systems Rust

Exam: A Safe Environment

Wrap two Win32 calls in a safe Rust API: UTF-16, the two-call size pattern and real errors.

Part of Step Into Rust. The full module exam, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.

Rust's standard library already reads environment variables, but somebody had to write that on top of the Win32 API, and today that somebody is you. Build set_env and get_env from SetEnvironmentVariableW and GetEnvironmentVariableW: no fixed-size buffers, values of any length, any Unicode, and errors that explain themselves in the words Windows uses.

In this module exam

Missions

  1. set_env and get_env, done right