I'm improvising here, but if pins can be switched from read to write (but can only be in one of those at a time), then in Rust you should be able to use the borrow checker to provide additional guarantees. As long as a pin is borrowed by a ReadPin, you can't create a WritePin, and viceversa.
As you say, you can use the same approach in C++, but this is one reason why the approach is extra interesting in Rust.
As you say, you can use the same approach in C++, but this is one reason why the approach is extra interesting in Rust.