diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2021-02-12 13:19:30 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2021-02-12 17:04:28 +0100 |
commit | 53cd6d1f3558eeea08cf0236be88704cd1b118cb (patch) | |
tree | 25c2b495cc7dae077340472ea8871130e3c85f1d /openpgp/src/armor.rs | |
parent | ee36f89cba1109be4c2b5a146cae1ac119d94760 (diff) |
openpgp: Turn comment into documentation comment.
Diffstat (limited to 'openpgp/src/armor.rs')
-rw-r--r-- | openpgp/src/armor.rs | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/openpgp/src/armor.rs b/openpgp/src/armor.rs index 3e8cbe46..8f7f69ab 100644 --- a/openpgp/src/armor.rs +++ b/openpgp/src/armor.rs @@ -994,27 +994,29 @@ fn common_prefix<A: AsRef<[u8]>, B: AsRef<[u8]>>(a: A, b: B) -> usize { a.as_ref().iter().zip(b.as_ref().iter()).take_while(|(a, b)| a == b).count() } -// Remove whitespace, etc. from the base64 data. -// -// This function returns the filtered base64 data (i.e., stripped of -// all skipable data like whitespace), and the amount of unfiltered -// data that corresponds to. Thus, if we have the following 7 bytes: -// -// ab cde -// 0123456 -// -// This function returns ("abcd", 6), because the 'd' is the last -// character in the last complete base64 chunk, and it is at offset 5. -// -// If 'd' is followed by whitespace, it is undefined whether that -// whitespace is included in the count. -// -// This function only returns full chunks of base64 data. As a -// consequence, if base64_data_max is less than 4, then this will not -// return any data. -// -// This function will stop after it sees base64 padding, and if it -// sees invalid base64 data. +/// Remove whitespace, etc. from the base64 data. +/// +/// This function returns the filtered base64 data (i.e., stripped of +/// all skipable data like whitespace), and the amount of unfiltered +/// data that corresponds to. Thus, if we have the following 7 bytes: +/// +/// ```text +/// ab cde +/// 0123456 +/// ``` +/// +/// This function returns ("abcd", 6), because the 'd' is the last +/// character in the last complete base64 chunk, and it is at offset 5. +/// +/// If 'd' is followed by whitespace, it is undefined whether that +/// whitespace is included in the count. +/// +/// This function only returns full chunks of base64 data. As a +/// consequence, if base64_data_max is less than 4, then this will not +/// return any data. +/// +/// This function will stop after it sees base64 padding, and if it +/// sees invalid base64 data. fn base64_filter(mut bytes: Cow<[u8]>, base64_data_max: usize, mut prefix_remaining: usize, prefix_len: usize) -> (Cow<[u8]>, usize, usize) |