diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-05-21 15:01:42 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-05-21 15:04:44 +0200 |
commit | f4fcc75d9bc17c9af6821e35b0991906e72e76fa (patch) | |
tree | 176fdc3a1902d3c83f420416cdb9ebeecd793e9b /openpgp/src/serialize/writer | |
parent | 8896bf5cfe0a1251c47a0cdeae01e5026d596a2c (diff) |
openpgp: Mark methods as unreachable.
- The private trait Stackable has two functions that are only
implemented by the streaming Signer. Mark these functions as such
in the documentation as well as the stub implementations.
Diffstat (limited to 'openpgp/src/serialize/writer')
-rw-r--r-- | openpgp/src/serialize/writer/mod.rs | 12 | ||||
-rw-r--r-- | openpgp/src/serialize/writer/writer_bzip2.rs | 4 | ||||
-rw-r--r-- | openpgp/src/serialize/writer/writer_deflate.rs | 8 |
3 files changed, 14 insertions, 10 deletions
diff --git a/openpgp/src/serialize/writer/mod.rs b/openpgp/src/serialize/writer/mod.rs index 3368c6ff..a02339b0 100644 --- a/openpgp/src/serialize/writer/mod.rs +++ b/openpgp/src/serialize/writer/mod.rs @@ -83,9 +83,13 @@ pub(crate) trait Stackable<'a, C> : io::Write + fmt::Debug { /// Pops the stackable from the stack, detaching it. /// /// Returns the detached stack. + /// + /// Note: Only the Signer implements this interface. fn pop(&mut self) -> Result<Option<BoxStack<'a, C>>>; /// Sets the inner stackable. + /// + /// Note: Only the Signer implements this interface. fn mount(&mut self, new: BoxStack<'a, C>); /// Returns a mutable reference to the inner `Writer`, if @@ -380,10 +384,10 @@ impl<'a, C: 'a> Stackable<'a, C> for Encryptor<'a, C> { Ok(Some(inner)) } fn pop(&mut self) -> Result<Option<BoxStack<'a, C>>> { - unimplemented!() + unreachable!("Only implemented by Signer") } fn mount(&mut self, _new: BoxStack<'a, C>) { - unimplemented!() + unreachable!("Only implemented by Signer") } fn inner_mut(&mut self) -> Option<&mut Stackable<'a, C>> { self.inner.inner_mut() @@ -448,10 +452,10 @@ impl<'a, C: 'a> Stackable<'a, C> for AEADEncryptor<'a, C> { Ok(Some(inner)) } fn pop(&mut self) -> Result<Option<BoxStack<'a, C>>> { - unimplemented!() + unreachable!("Only implemented by Signer") } fn mount(&mut self, _new: BoxStack<'a, C>) { - unimplemented!() + unreachable!("Only implemented by Signer") } fn inner_mut(&mut self) -> Option<&mut Stackable<'a, C>> { self.inner.inner_mut() diff --git a/openpgp/src/serialize/writer/writer_bzip2.rs b/openpgp/src/serialize/writer/writer_bzip2.rs index d0189821..513e95e6 100644 --- a/openpgp/src/serialize/writer/writer_bzip2.rs +++ b/openpgp/src/serialize/writer/writer_bzip2.rs @@ -46,10 +46,10 @@ impl<'a, C: 'a> Stackable<'a, C> for BZ<'a, C> { Ok(Some(inner)) } fn pop(&mut self) -> Result<Option<BoxStack<'a, C>>> { - unimplemented!() + unreachable!("Only implemented by Signer") } fn mount(&mut self, _new: BoxStack<'a, C>) { - unimplemented!() + unreachable!("Only implemented by Signer") } fn inner_mut(&mut self) -> Option<&mut Stackable<'a, C>> { self.inner.inner_mut() diff --git a/openpgp/src/serialize/writer/writer_deflate.rs b/openpgp/src/serialize/writer/writer_deflate.rs index f5cdcb7d..64e547f1 100644 --- a/openpgp/src/serialize/writer/writer_deflate.rs +++ b/openpgp/src/serialize/writer/writer_deflate.rs @@ -46,10 +46,10 @@ impl<'a, C: 'a> Stackable<'a, C> for ZIP<'a, C> { Ok(Some(inner)) } fn pop(&mut self) -> Result<Option<BoxStack<'a, C>>> { - unimplemented!() + unreachable!("Only implemented by Signer") } fn mount(&mut self, _new: BoxStack<'a, C>) { - unimplemented!() + unreachable!("Only implemented by Signer") } fn inner_mut(&mut self) -> Option<&mut Stackable<'a, C>> { self.inner.inner_mut() @@ -108,10 +108,10 @@ impl<'a, C: 'a> Stackable<'a, C> for ZLIB<'a, C> { Ok(Some(inner)) } fn pop(&mut self) -> Result<Option<BoxStack<'a, C>>> { - unimplemented!() + unreachable!("Only implemented by Signer") } fn mount(&mut self, _new: BoxStack<'a, C>) { - unimplemented!() + unreachable!("Only implemented by Signer") } fn inner_mut(&mut self) -> Option<&mut Stackable<'a, C>> { self.inner.inner_mut() |