See https://rust-lang.github.io/api-guidelines/interoperability.html#c-good-err
I would recommend a type like the following:
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
struct ParseSysnoError {
string: String,
}
impl fmt::Display for ParseSysnoError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "provided string '{}' was not a known syscall", &self.string)?;
Ok(())
}
}
impl std::error::Error for ParseSysnoError {}