(&mut self, buf: &mut [u8])
| 252 | #[cfg_attr(docsrs, doc(cfg(feature = "std")))] |
| 253 | impl<'i, E: Encoding> io::Read for Decoder<'i, E> { |
| 254 | fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { |
| 255 | if self.is_finished() { |
| 256 | return Ok(0); |
| 257 | } |
| 258 | let slice = match buf.get_mut(..self.remaining_len()) { |
| 259 | Some(bytes) => bytes, |
| 260 | None => buf, |
| 261 | }; |
| 262 | |
| 263 | self.decode(slice)?; |
| 264 | Ok(slice.len()) |
| 265 | } |
| 266 | |
| 267 | fn read_to_end(&mut self, buf: &mut Vec<u8>) -> io::Result<usize> { |
| 268 | if self.is_finished() { |
nothing calls this directly
no test coverage detected