Skip to content

der: use &mut dyn Writer as output for Encode::encode #611

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

Merged
merged 1 commit into from
Apr 25, 2022

Conversation

tarcieri
Copy link
Member

Implements encoding in terms of the Writer trait.

To allow Encode to continue to function as a trait object, the Writer must also be a trait object.

This approach should enable 1-pass PEM encoding as well as computing key fingerprints without an output buffer. It might come at a cost to performance due to the increased use of trait objects.

It might be possible to retain monomorphization using Encode<W: Writer> but at a cost to ergonomics. However, that might be worth exploring depending on the performance.

Implements encoding in terms of the `Writer` trait.

To allow `Encode` to continue to function as a trait object, the
`Writer` must also be a trait object.

This approach should enable 1-pass PEM encoding as well as computing key
fingerprints without an output buffer. It might come at a cost to
performance due to the increased use of trait objects.

It might be possible to retain monomorphization using
`Encode<W: Writer>` but at a cost to ergonomics. However, that might be
worth exploring depending on the performance.
@tarcieri tarcieri merged commit 01dc4cd into master Apr 25, 2022
@tarcieri tarcieri deleted the der/use-writer-trait-for-encode branch April 25, 2022 13:39
tarcieri added a commit that referenced this pull request May 4, 2022
Implements decoding generically in terms of the `Reader` trait, similar
to what #611 did for encoding.

This approach can enable 1-pass on-the-fly PEM decoding for
`DecodeOwned` types (although that will require some additional work
beyond what's in this PR).
tarcieri added a commit that referenced this pull request May 4, 2022
Implements decoding generically in terms of the `Reader` trait, similar
to what #611 did for encoding.

This approach can enable 1-pass on-the-fly PEM decoding for
`DecodeOwned` types (although that will require some additional work
beyond what's in this PR).
tarcieri added a commit that referenced this pull request May 4, 2022
Implements decoding generically in terms of the `Reader` trait, similar
to what #611 did for encoding.

This approach can enable 1-pass on-the-fly PEM decoding for
`DecodeOwned` types (although that will require some additional work
beyond what's in this PR).
tarcieri added a commit that referenced this pull request May 4, 2022
Implements decoding generically in terms of the `Reader` trait, similar
to what #611 did for encoding.

This approach can enable 1-pass on-the-fly PEM decoding for
`DecodeOwned` types (although that will require some additional work
beyond what's in this PR).
tarcieri added a commit that referenced this pull request May 4, 2022
Implements decoding generically in terms of the `Reader` trait, similar
to what #611 did for encoding.

This approach can enable 1-pass on-the-fly PEM decoding for
`DecodeOwned` types (although that will require some additional work
beyond what's in this PR).
tarcieri added a commit that referenced this pull request May 4, 2022
Implements decoding generically in terms of the `Reader` trait, similar
to what #611 did for encoding.

This approach can enable 1-pass on-the-fly PEM decoding for
`DecodeOwned` types (although that will require some additional work
beyond what's in this PR).
tarcieri added a commit that referenced this pull request May 4, 2022
Implements decoding generically in terms of the `Reader` trait, similar
to what #611 did for encoding.

This approach can enable 1-pass on-the-fly PEM decoding for
`DecodeOwned` types (although that will require some additional work
beyond what's in this PR).
@tarcieri tarcieri mentioned this pull request May 8, 2022
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