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

Ouverte
#2,533 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
35/100
Type d'issue
Refactorisation
Clarté
Plutôt claire
Activité
Active
Stack technique
rust
Domaine
backend

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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.

Langage dominant
Rust
Étoiles
347
Forks
200
Merge moyen
20 h 27 min
PR mergées (30 j)
35

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de RustCrypto/formats

Toutes les issues de RustCrypto/formats

Issues similaires

Plus d'issues Rust

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.