Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh-encoding: remove NestedReader #226

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

tarcieri
Copy link
Member

Changes Reader::read_prefixed from a provided method to one which must be impl'd by all of the Reader types, of which there are currently three:

  • &[u8]
  • Base64Reader
  • PemReader

This should reduce monomorphization bloat from NestedReader which encapsulates other reader types, including other NestedReaders, depending on the level of nesting, which is generally low, but good to eliminate entirely.

This does lead to a small amount of duplication between Base64Reader and PemReader which was previously encapsulated in NestedReader. It can possibly be eliminated in followup work.

@tarcieri tarcieri force-pushed the ssh-encoding/remove-nested-reader branch 4 times, most recently from 1c6cdd4 to e4ba8fc Compare April 29, 2024 03:10
Changes `Reader::read_prefixed` from a provided method to one which must
be impl'd by all of the `Reader` types, of which there are currently
three:

- `&[u8]`
- `Base64Reader`
- `PemReader`

This should reduce monomorphization bloat from `NestedReader` which
encapsulates other reader types, including other `NestedReader`s,
depending on the level of nesting, which is generally low, but good to
eliminate entirely.

The `Reader` impl is written identically between `Base64Reader` and
`PemReader` and currently impl'd as a macro to prevent duplication,
however a more elegant solution would be nice, e.g. a generic method.
@tarcieri tarcieri force-pushed the ssh-encoding/remove-nested-reader branch from e4ba8fc to ec120f2 Compare April 29, 2024 03:12
@tarcieri tarcieri merged commit 72a1e86 into master Apr 29, 2024
25 checks passed
@tarcieri tarcieri deleted the ssh-encoding/remove-nested-reader branch April 29, 2024 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant