RustCrypto / RustCrypto/formats
der: Move `error.position` from Error to Reader
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 338
- Forks
- 188
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 15
Description
Currently, it is annoying to track error.position in every function returning der::Error.
From another issue:
Attempting to even construct der::Error was confusing [...] It is also unclear to me whether the position that this method uses will be correct [...]
- #1492
What I suggest is something like serde + quick-xml:
let mut reader = SliceReader::new(EXAMPLE_MSG).unwrap();
let err = SomeStruct::decode(&mut reader);
assert!(err.is_err());
assert_eq!(reader.error_position(), 28);
https://docs.rs/quick-xml/latest/quick_xml/de/struct.Deserializer.html#method.get_ref
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with der/src/error.rs and the SliceReader API described in the issue, then compare the referenced serde and quick-xml approach. Define how decoding errors expose their position through the reader, including the example expecting position 28. Done means the proposed reader-based error-position behavior is implemented and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cryptography
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100