diff options
Diffstat (limited to 'buffered-reader')
-rw-r--r-- | buffered-reader/src/decompress_bzip2.rs | 2 | ||||
-rw-r--r-- | buffered-reader/src/decompress_deflate.rs | 4 | ||||
-rw-r--r-- | buffered-reader/src/dup.rs | 2 | ||||
-rw-r--r-- | buffered-reader/src/lib.rs | 16 | ||||
-rw-r--r-- | buffered-reader/src/limitor.rs | 2 | ||||
-rw-r--r-- | buffered-reader/src/reserve.rs | 2 |
6 files changed, 21 insertions, 7 deletions
diff --git a/buffered-reader/src/decompress_bzip2.rs b/buffered-reader/src/decompress_bzip2.rs index d292390f..8f05cc43 100644 --- a/buffered-reader/src/decompress_bzip2.rs +++ b/buffered-reader/src/decompress_bzip2.rs @@ -108,7 +108,7 @@ impl<R: BufferedReader<C>, C: fmt::Debug + Send + Sync> BufferedReader<C> for Bz fn into_inner<'b>(self: Box<Self>) -> Option<Box<dyn BufferedReader<C> + 'b>> where Self: 'b { // Strip the outer box. - Some(self.reader.into_reader().into_inner().as_boxed()) + Some(self.reader.into_reader().into_inner().into_boxed()) } fn cookie_set(&mut self, cookie: C) -> C { diff --git a/buffered-reader/src/decompress_deflate.rs b/buffered-reader/src/decompress_deflate.rs index 790a5541..4036aa5e 100644 --- a/buffered-reader/src/decompress_deflate.rs +++ b/buffered-reader/src/decompress_deflate.rs @@ -109,7 +109,7 @@ impl<R: BufferedReader<C>, C: fmt::Debug + Send + Sync> BufferedReader<C> fn into_inner<'b>(self: Box<Self>) -> Option<Box<dyn BufferedReader<C> + 'b>> where Self: 'b { // Strip the outer box. - Some(self.reader.into_reader().into_inner().as_boxed()) + Some(self.reader.into_reader().into_inner().into_boxed()) } fn cookie_set(&mut self, cookie: C) -> C { @@ -235,7 +235,7 @@ impl<R: BufferedReader<C>, C: fmt::Debug + Send + Sync> BufferedReader<C> fn into_inner<'b>(self: Box<Self>) -> Option<Box<dyn BufferedReader<C> + 'b>> where Self: 'b { // Strip the outer box. - Some(self.reader.into_reader().into_inner().as_boxed()) + Some(self.reader.into_reader().into_inner().into_boxed()) } fn cookie_set(&mut self, cookie: C) -> C { diff --git a/buffered-reader/src/dup.rs b/buffered-reader/src/dup.rs index 5ad7dd48..458c6ba8 100644 --- a/buffered-reader/src/dup.rs +++ b/buffered-reader/src/dup.rs @@ -128,7 +128,7 @@ impl<T: BufferedReader<C>, C: fmt::Debug + Send + Sync> BufferedReader<C> for Du fn into_inner<'b>(self: Box<Self>) -> Option<Box<dyn BufferedReader<C> + 'b>> where Self: 'b { - Some(self.reader.as_boxed()) + Some(self.reader.into_boxed()) } fn cookie_set(&mut self, cookie: C) -> C { diff --git a/buffered-reader/src/lib.rs b/buffered-reader/src/lib.rs index a130ca7c..d52b3e0e 100644 --- a/buffered-reader/src/lib.rs +++ b/buffered-reader/src/lib.rs @@ -915,11 +915,19 @@ pub trait BufferedReader<C> : io::Read + fmt::Debug + fmt::Display + Send + Sync } /// Boxes the reader. + fn into_boxed<'a>(self) -> Box<dyn BufferedReader<C> + 'a> + where Self: 'a + Sized + { + Box::new(self) + } + + /// Boxes the reader. #[allow(clippy::wrong_self_convention)] + #[deprecated(note = "Use into_boxed")] fn as_boxed<'a>(self) -> Box<dyn BufferedReader<C> + 'a> where Self: 'a + Sized { - Box::new(self) + self.into_boxed() } /// Returns the underlying reader, if any. @@ -1066,6 +1074,12 @@ impl <'a, C: fmt::Debug + Sync + Send> BufferedReader<C> for Box<dyn BufferedRea self.as_ref().get_ref() } + fn into_boxed<'b>(self) -> Box<dyn BufferedReader<C> + 'b> + where Self: 'b + { + self + } + fn as_boxed<'b>(self) -> Box<dyn BufferedReader<C> + 'b> where Self: 'b { diff --git a/buffered-reader/src/limitor.rs b/buffered-reader/src/limitor.rs index ebf8d6b7..51e5c0d3 100644 --- a/buffered-reader/src/limitor.rs +++ b/buffered-reader/src/limitor.rs @@ -131,7 +131,7 @@ impl<T: BufferedReader<C>, C: fmt::Debug + Sync + Send> BufferedReader<C> for Li fn into_inner<'b>(self: Box<Self>) -> Option<Box<dyn BufferedReader<C> + 'b>> where Self: 'b { - Some(self.reader.as_boxed()) + Some(self.reader.into_boxed()) } fn cookie_set(&mut self, cookie: C) -> C { diff --git a/buffered-reader/src/reserve.rs b/buffered-reader/src/reserve.rs index 937abbae..d5ad84a1 100644 --- a/buffered-reader/src/reserve.rs +++ b/buffered-reader/src/reserve.rs @@ -132,7 +132,7 @@ impl<T: BufferedReader<C>, C: fmt::Debug + Send + Sync> BufferedReader<C> for Re fn into_inner<'b>(self: Box<Self>) -> Option<Box<dyn BufferedReader<C> + 'b>> where Self: 'b { - Some(self.reader.as_boxed()) + Some(self.reader.into_boxed()) } fn cookie_set(&mut self, cookie: C) -> C { |