summaryrefslogtreecommitdiffstats
path: root/openpgp/src/parse.rs
diff options
context:
space:
mode:
authorWiktor Kwapisiewicz <wiktor@metacode.biz>2023-05-30 12:03:15 +0200
committerWiktor Kwapisiewicz <wiktor@metacode.biz>2023-06-06 10:37:51 +0200
commitf5f9b14a304321816526c30ce98edbd6535df9c4 (patch)
treeccc0f752f9e1ea1037bd4f37a59a52387cd9e7fb /openpgp/src/parse.rs
parent4f3d260a013835a8ab0b2f15f45e22ca4678ab24 (diff)
buffered_reader: Introduce `into_boxed` and deprecate `as_boxed`.
- According to the Rust API Guidelines, a conversion function taking self should be called `into_*` if the self is not Copy, so this function should be named `into_boxed`. - Deprecate old function not to break the API. - Update all references in the code. - Fixes https://gitlab.com/sequoia-pgp/sequoia/-/issues/781
Diffstat (limited to 'openpgp/src/parse.rs')
-rw-r--r--openpgp/src/parse.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs
index 2dc9fad5..7c34f62b 100644
--- a/openpgp/src/parse.rs
+++ b/openpgp/src/parse.rs
@@ -341,7 +341,7 @@ macro_rules! impl_parse_with_buffered_reader {
fn from_buffered_reader<'a, B>(br: B) -> Result<Self>
where B: 'a + BufferedReader<Cookie>,
{
- Ok($from_buffered_reader(br.as_boxed())?)
+ Ok($from_buffered_reader(br.into_boxed())?)
}
}
@@ -1110,7 +1110,7 @@ impl<'a> Parse<'a, S2K> for S2K {
fn from_reader<R: 'a + Read + Send + Sync>(reader: R) -> Result<Self> {
let bio = buffered_reader::Generic::with_cookie(
reader, None, Cookie::default());
- let mut parser = PacketHeaderParser::new_naked(bio.as_boxed());
+ let mut parser = PacketHeaderParser::new_naked(bio.into_boxed());
Self::parse_v4(&mut parser)
}
}
@@ -3052,7 +3052,7 @@ impl<'a> Parse<'a, MPI> for MPI {
fn from_reader<R: io::Read + Send + Sync>(reader: R) -> Result<Self> {
let bio = buffered_reader::Generic::with_cookie(
reader, None, Cookie::default());
- let mut parser = PacketHeaderParser::new_naked(bio.as_boxed());
+ let mut parser = PacketHeaderParser::new_naked(bio.into_boxed());
Self::parse("(none_len)", "(none)", &mut parser)
}
}
@@ -3533,7 +3533,7 @@ impl<'a> PacketParserEOF<'a> {
Self::new(
PacketParserState::new(Default::default()),
buffered_reader::Memory::with_cookie(b"", Default::default())
- .as_boxed())
+ .into_boxed())
}
/// Returns whether the stream is an OpenPGP Message.