diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-01-10 13:11:45 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-01-10 13:56:11 +0100 |
commit | 71fc2c6afbcbf4cc4e060dd59300e8065e699323 (patch) | |
tree | c1b4ae762fcea2a137bb8c585d9e47bc86402357 /openpgp/examples | |
parent | b64d45cf84cb7baee3a88a12f1cbf52ad3fb74d3 (diff) |
openpgp: Pass MessageStructure by value, not reference.
- Instead of passing MessageStructure to VerificationHelper::check
by reference, pass it by value.
- After calling VerificationHelper::check, it is dropped. Passing
it by value allows the caller to avoid some cloning.
Diffstat (limited to 'openpgp/examples')
-rw-r--r-- | openpgp/examples/decrypt-with.rs | 2 | ||||
-rw-r--r-- | openpgp/examples/generate-encrypt-decrypt.rs | 2 | ||||
-rw-r--r-- | openpgp/examples/generate-sign-verify.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/openpgp/examples/decrypt-with.rs b/openpgp/examples/decrypt-with.rs index c28dbe1c..35393924 100644 --- a/openpgp/examples/decrypt-with.rs +++ b/openpgp/examples/decrypt-with.rs @@ -105,7 +105,7 @@ impl VerificationHelper for Helper { -> failure::Fallible<Vec<openpgp::Cert>> { Ok(Vec::new()) // Feed the Certs to the verifier here. } - fn check(&mut self, structure: &MessageStructure) + fn check(&mut self, structure: MessageStructure) -> failure::Fallible<()> { use self::VerificationResult::*; for layer in structure.iter() { diff --git a/openpgp/examples/generate-encrypt-decrypt.rs b/openpgp/examples/generate-encrypt-decrypt.rs index d431e99c..4d456193 100644 --- a/openpgp/examples/generate-encrypt-decrypt.rs +++ b/openpgp/examples/generate-encrypt-decrypt.rs @@ -100,7 +100,7 @@ impl<'a> VerificationHelper for Helper<'a> { Ok(Vec::new()) } - fn check(&mut self, _structure: &MessageStructure) + fn check(&mut self, _structure: MessageStructure) -> openpgp::Result<()> { // Implement your signature verification policy here. Ok(()) diff --git a/openpgp/examples/generate-sign-verify.rs b/openpgp/examples/generate-sign-verify.rs index f238d368..fa75ed6d 100644 --- a/openpgp/examples/generate-sign-verify.rs +++ b/openpgp/examples/generate-sign-verify.rs @@ -93,7 +93,7 @@ impl<'a> VerificationHelper for Helper<'a> { Ok(vec![self.cert.clone()]) } - fn check(&mut self, structure: &MessageStructure) + fn check(&mut self, structure: MessageStructure) -> openpgp::Result<()> { // In this function, we implement our signature verification // policy. |