diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2018-10-16 15:06:10 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2018-10-16 16:25:39 +0200 |
commit | 3d996ff3bc0e939caa6c0edb81c75e763d8c8344 (patch) | |
tree | f1d32b1d1b6531c8708cbf0d7641a93ac9f636c6 /openpgp/examples/wrap-literal.rs | |
parent | 09664cf092f19648c8d2a14ff1b76d418ed0a42f (diff) |
openpgp: Improve the streaming writer API.
- Also, improve documentation and doctests.
Diffstat (limited to 'openpgp/examples/wrap-literal.rs')
-rw-r--r-- | openpgp/examples/wrap-literal.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/openpgp/examples/wrap-literal.rs b/openpgp/examples/wrap-literal.rs index b7cea74e..9d9560e3 100644 --- a/openpgp/examples/wrap-literal.rs +++ b/openpgp/examples/wrap-literal.rs @@ -9,7 +9,7 @@ use std::io; extern crate openpgp; use openpgp::armor; use openpgp::constants::DataFormat; -use openpgp::serialize::stream::{wrap, LiteralWriter}; +use openpgp::serialize::stream::{Message, LiteralWriter}; fn main() { let args: Vec<String> = env::args().collect(); @@ -24,9 +24,12 @@ fn main() { let sink = armor::Writer::new(io::stdout(), armor::Kind::Message, &[][..]) .expect("Failed to create armored writer."); + // Stream an OpenPGP message. + let message = Message::new(sink); + // Then, create a literal writer to wrap the data in a literal // message packet. - let mut literal = LiteralWriter::new(wrap(sink), DataFormat::Binary, + let mut literal = LiteralWriter::new(message, DataFormat::Binary, None, None) .expect("Failed to create literal writer"); |