jasonwhite / jasonwhite/syscalls
Sysno::from_str should return well error type
- Dominant language
- Rust
- Stars
- 141
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
See https://rust-lang.github.io/api-guidelines/interoperability.html#c-good-err
I would recommend a type like the following:
```rust
#[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 {}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Locate the implementation of Sysno::from_str and any existing parsing tests. Compare its current error behavior with the proposed ParseSysnoError shape and the Rust API guideline linked in the issue. Done means the method returns a well-defined error containing the provided string, with tests covering the failure case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- Half a day
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100