Skip to content

Sysno::from_str should return well error type #52

@rusty-snake

Description

@rusty-snake

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 {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions