diff options
Diffstat (limited to 'openpgp/examples/pad.rs')
-rw-r--r-- | openpgp/examples/pad.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/openpgp/examples/pad.rs b/openpgp/examples/pad.rs index c1c341c8..6f49cbf3 100644 --- a/openpgp/examples/pad.rs +++ b/openpgp/examples/pad.rs @@ -51,11 +51,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( @@ -78,4 +78,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"); } |