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 /guide/src | |
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 'guide/src')
-rw-r--r-- | guide/src/chapter_01.md | 8 | ||||
-rw-r--r-- | guide/src/chapter_02.md | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/guide/src/chapter_01.md b/guide/src/chapter_01.md index 78978161..fa4b505c 100644 --- a/guide/src/chapter_01.md +++ b/guide/src/chapter_01.md @@ -102,7 +102,7 @@ fn main() { # 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. @@ -247,7 +247,7 @@ fn generate() -> openpgp::Result<openpgp::Cert> { # 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. @@ -392,7 +392,7 @@ fn sign(sink: &mut Write, plaintext: &str, tsk: &openpgp::Cert) # 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. @@ -548,7 +548,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. diff --git a/guide/src/chapter_02.md b/guide/src/chapter_02.md index f6cb4b48..c9c22961 100644 --- a/guide/src/chapter_02.md +++ b/guide/src/chapter_02.md @@ -109,7 +109,7 @@ fn main() { # Ok(Vec::new()) # } # -# fn check(&mut self, _structure: &MessageStructure) +# fn check(&mut self, _structure: MessageStructure) # -> openpgp::Result<()> { # // Implement your signature verification policy here. # Ok(()) @@ -250,7 +250,7 @@ fn generate() -> openpgp::Result<openpgp::Cert> { # Ok(Vec::new()) # } # -# fn check(&mut self, _structure: &MessageStructure) +# fn check(&mut self, _structure: MessageStructure) # -> openpgp::Result<()> { # // Implement your signature verification policy here. # Ok(()) @@ -391,7 +391,7 @@ fn encrypt(sink: &mut Write, plaintext: &str, recipient: &openpgp::Cert) # Ok(Vec::new()) # } # -# fn check(&mut self, _structure: &MessageStructure) +# fn check(&mut self, _structure: MessageStructure) # -> openpgp::Result<()> { # // Implement your signature verification policy here. # Ok(()) @@ -546,7 +546,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(()) |