der: extract a `Decoder` type in next breaking release

Aperta
#2,533 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
backend

Direzione di ricerca

Start by comparing the der reader implementations and their Reader::read_nested methods with the Decoder approach in the linked SSH pull request #618. The issue proposes centralizing nested production handling in a generic Decoder for the next breaking release, but leaves the design and scope open. Done means reducing duplicated reader logic while preserving decoding behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

der used to have a Decoder type, but it was refactored into SliceReader. Logic for handling nested productions winds up duplicated among the various *Reader impls in their Reader::read_nested methods, which are custom implemented per Reader type.

In ssh-encoding, which uses a similar arrangement of types, I introduced a Decoder type generic over a backend Reader which handles the central logic for consuming data from the readers, and all of the Decode methods now accept a &mut Decoder<impl Reader>: https://github.com/RustCrypto/SSH/pull/618

In the next breaking release of der I think it'd be nice to do something similar. I added some partial shared logic in the Position type, but really it'd be nice to eliminate the duplication of logic between the reader types.

Lingua principale
Rust
Stelle
347
Fork
200
Merge medio
20h 27m
PR unite (30g)
35

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di RustCrypto/formats

Tutte le issue di RustCrypto/formats

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.