summaryrefslogtreecommitdiffstats
path: root/openpgp/examples/encrypt-for.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/examples/encrypt-for.rs')
-rw-r--r--openpgp/examples/encrypt-for.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/openpgp/examples/encrypt-for.rs b/openpgp/examples/encrypt-for.rs
index 557e648f..ef6486eb 100644
--- a/openpgp/examples/encrypt-for.rs
+++ b/openpgp/examples/encrypt-for.rs
@@ -50,11 +50,11 @@ fn main() {
// Compose a writer stack corresponding to the output format and
// packet structure we want. First, we want the output to be
// ASCII armored.
- let sink = armor::Writer::new(io::stdout(), armor::Kind::Message, &[])
+ let mut sink = armor::Writer::new(io::stdout(), armor::Kind::Message, &[])
.expect("Failed to create an armored writer");
// Stream an OpenPGP message.
- let message = Message::new(sink);
+ let message = Message::new(&mut sink);
// We want to encrypt a literal data packet.
let mut encryptor = Encryptor::for_recipient(
@@ -74,4 +74,8 @@ fn main() {
// Finally, finalize the OpenPGP message by tearing down the
// writer stack.
literal_writer.finalize().unwrap();
+
+ // Finalize the armor writer.
+ sink.finalize()
+ .expect("Failed to write data");
}