Function design_pattern_examples_rust::adapter::adapter_exercise
source · pub fn adapter_exercise() -> Result<(), String>
Expand description
Example of using the “Adapter” design pattern in rust.
This example adapts functions that:
- Accesses memory in 32-bit chunks instead of bytes
- Returns error codes but no human-readable error messages
The Adapter functions translate the 32-bit chunk access into arrays of bytes. The Adapter functions also provide human-readable messages for error codes.