diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-09-10 13:27:53 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-09-10 13:33:02 +0200 |
commit | cc5c9280786ab0240bb62a0c80fa1e1c3dbe650a (patch) | |
tree | a8a228056b1a276d5e516cb296b57943b0656b01 /openpgp/src/serialize/stream.rs | |
parent | ff5a8f2536193b80af2d1bcf308db9d59b084e83 (diff) |
openpgp: Make algorithm parameter optional.
Diffstat (limited to 'openpgp/src/serialize/stream.rs')
-rw-r--r-- | openpgp/src/serialize/stream.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/openpgp/src/serialize/stream.rs b/openpgp/src/serialize/stream.rs index d69f51fc..b3dbb262 100644 --- a/openpgp/src/serialize/stream.rs +++ b/openpgp/src/serialize/stream.rs @@ -759,12 +759,14 @@ impl<'a> Compressor<'a> { /// /// Passing `None` to `compression_level` selects the default /// compression level. - pub fn new<L>(inner: writer::Stack<'a, Cookie>, algo: CompressionAlgorithm, - compression_level: L) - -> Result<writer::Stack<'a, Cookie>> - where L: Into<Option<writer::CompressionLevel>> + pub fn new<C, L>(inner: writer::Stack<'a, Cookie>, + algo: C, compression_level: L) + -> Result<writer::Stack<'a, Cookie>> + where C: Into<Option<CompressionAlgorithm>>, + L: Into<Option<writer::CompressionLevel>> { let mut inner = writer::BoxStack::from(inner); + let algo = algo.into().unwrap_or_default(); let compression_level = compression_level.into().unwrap_or_default(); let level = inner.cookie_ref().level + 1; |