Recognizing anti-patterns of ownership
Consider the following situation.
Congratulations, you have inherited legacy code. A previous team responsible for developing privileged access modules for elevators has been moved to a different project. They successfully developed code libraries to interface with a range of microcontrollers. However, while developing the access logic in Rust, they found object ownership to be very complicated and were unable to develop software that was compatible with Rust.
Your task in this chapter will be to analyze their code, look for possible solutions, then create a library to support privileged access for your elevators. To clarify, privileged access refers to override codes and keys made available to emergency services such as police, firemen, and so on.
Inspecting the microcontroller drivers
The microcontroller drivers are written in other languages and exposed to Rust through the foreign function interface (FFI) feature. An FFI is a way of connecting Rust code...