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/sign.rs | |
parent | 09664cf092f19648c8d2a14ff1b76d418ed0a42f (diff) |
openpgp: Improve the streaming writer API.
- Also, improve documentation and doctests.
Diffstat (limited to 'openpgp/examples/sign.rs')
-rw-r--r-- | openpgp/examples/sign.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/openpgp/examples/sign.rs b/openpgp/examples/sign.rs index 03117ed5..6b05a08c 100644 --- a/openpgp/examples/sign.rs +++ b/openpgp/examples/sign.rs @@ -6,7 +6,7 @@ use std::io; extern crate openpgp; use openpgp::armor; use openpgp::constants::DataFormat; -use openpgp::serialize::stream::{wrap, LiteralWriter, Signer}; +use openpgp::serialize::stream::{Message, LiteralWriter, Signer}; fn main() { let args: Vec<String> = env::args().collect(); @@ -32,9 +32,12 @@ fn main() { let 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); + // Now, create a signer that emits a signature. let signer = Signer::new( - wrap(sink), &tsks.iter().collect::<Vec<&openpgp::TPK>>()) + message, &tsks.iter().collect::<Vec<&openpgp::TPK>>()) .expect("Failed to create signer"); // Then, create a literal writer to wrap the data in a literal |