twizzler-operating-system / twizzler

The Twizzler Operating System
BSD 3-Clause "New" or "Revised" License
68 stars 15 forks source link

Implement core::error::Error for low level Twizzler error types #177

Closed dbittman closed 5 months ago

dbittman commented 5 months ago

This PR implements the Error trait for the low level error types in twizzler-abi and twizzler-runtime-api, significantly improving the ergonomics of working with low level Twizzler errors.

In twizzler-abi, we can use thiserror (well, a fork of it that adds no_std support) directly. However, in twizzler-runtime-api, we have to implement Display and Error manually, because derive macros are hard to use in deps of libstd.

While implementing Error for twizzler-abi syscall error types, I cleaned up the Into/From u64 code for those types, by using a derive macro.