diff options
Diffstat (limited to 'openpgp/src')
92 files changed, 20968 insertions, 8107 deletions
diff --git a/openpgp/src/armor.rs b/openpgp/src/armor.rs index 6f11958b..2425c804 100644 --- a/openpgp/src/armor.rs +++ b/openpgp/src/armor.rs @@ -1,8 +1,9 @@ //! ASCII Armor. //! -//! This module deals with ASCII Armored data (see [RFC 4880, section 6]). +//! This module deals with ASCII Armored data (see [Section 6 of RFC +//! 4880]). //! -//! [RFC 4880, section 6]: https://tools.ietf.org/html/rfc4880#section-6 +//! [Section 6 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-6 //! //! # Scope //! @@ -33,6 +34,8 @@ use std::path::Path; use std::cmp; use std::str; use std::borrow::Cow; + +#[cfg(any(test, feature = "quickcheck"))] use quickcheck::{Arbitrary, Gen}; use crate::vec_truncate; @@ -67,6 +70,7 @@ pub enum Kind { File, } +#[cfg(any(test, feature = "quickcheck"))] impl Arbitrary for Kind { fn arbitrary<G: Gen>(g: &mut G) -> Self { use self::Kind::*; @@ -129,7 +133,7 @@ impl Kind { /// This does not include any trailing newline. It is simply the /// length of: /// - /// ```norun + /// ```text /// -----BEGIN PGP BLUB ----- /// ``` fn header_len(&self) -> usize { @@ -140,7 +144,7 @@ impl Kind { /// A filter that applies ASCII Armor to the data written to it. pub struct Writer<W: Write> { - sink: Option<W>, + sink: W, kind: Kind, stash: Vec<u8>, column: usize, @@ -152,12 +156,33 @@ pub struct Writer<W: Write> { impl<W: Write> Writer<W> { /// Constructs a new filter for the given type of data. /// - /// Note: To ensure that we can handle errors during writing of - /// the armor footer, this object must be consumed by calling - /// [`Writer::finalize()`]. If the object |