Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit c6d4ca4

Browse files
committed
remove Take
1 parent 6b7b28f commit c6d4ca4

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

src/literacy.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,10 @@
2626
pub trait Read {
2727
/// The error type returned in Result
2828
type Error;
29-
/// The type to implement limited reads
30-
type Take: Read;
3129
/// see [std::io::Read::read]
3230
fn read(&mut self, buf: &mut [u8]) -> ::core::result::Result<usize, Self::Error>;
3331
/// see [std::io::Read::read_exact]
3432
fn read_exact(&mut self, buf: &mut [u8]) -> ::core::result::Result<(), Self::Error>;
35-
/// see [std::io::Read::take]
36-
fn take(self, limit: u64) -> Self::Take;
3733
}
3834

3935
/// The Write trait allows to write bytes in the object implementing it.
@@ -57,7 +53,6 @@ mod std_impl {
5753

5854
impl<R: ::std::io::Read> Read for R {
5955
type Error = ::std::io::Error;
60-
type Take = ::std::io::Take<R>;
6156

6257
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
6358
<Self as ::std::io::Read>::read(self, buf)
@@ -66,11 +61,6 @@ mod std_impl {
6661
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Self::Error> {
6762
<Self as ::std::io::Read>::read_exact(self, buf)
6863
}
69-
70-
fn take(self, limit: u64) -> Self::Take {
71-
<Self as ::std::io::Read>::take(self, limit)
72-
}
73-
7464
}
7565

7666
impl<W: ::std::io::Write> Write for W {
@@ -99,7 +89,6 @@ mod core2_impl {
9989

10090
impl<R: core2::io::Read> Read for R {
10191
type Error = core2::io::Error;
102-
type Take = core2::io::Take<R>;
10392

10493
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
10594
<Self as core2::io::Read>::read(self, buf)
@@ -108,10 +97,6 @@ mod core2_impl {
10897
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Self::Error> {
10998
<Self as core2::io::Read>::read_exact(self, buf)
11099
}
111-
112-
fn take(self, limit: u64) -> Self::Take {
113-
<Self as core2::io::Read>::take(self, limit)
114-
}
115100
}
116101

117102
impl<W: core2::io::Write> Write for W {
@@ -145,7 +130,6 @@ mod default_impl {
145130

146131
impl<'a> Read for &'a [u8] {
147132
type Error = Error;
148-
type Take = &'a [u8];
149133

150134
fn read(&mut self, buf: &mut [u8]) -> ::core::result::Result<usize, Self::Error> {
151135
let amt = ::core::cmp::min(buf.len(), self.len());
@@ -182,10 +166,6 @@ mod default_impl {
182166
*self = b;
183167
Ok(())
184168
}
185-
186-
fn take(self, limit: u64) -> Self::Take {
187-
&self[..limit as usize]
188-
}
189169
}
190170

191171
impl Write for ::alloc::vec::Vec<u8> {

0 commit comments

Comments
 (0)