(src: &mut (impl AsyncRead + Unpin), buf: &mut [u8])
| 154 | } |
| 155 | |
| 156 | pub(super) async fn read_exact(src: &mut (impl AsyncRead + Unpin), buf: &mut [u8]) -> io::Result<DidReadExact> { |
| 157 | src.read_exact(buf).await.map(|_| DidReadExact::All).or_else(|e| { |
| 158 | if e.kind() == io::ErrorKind::UnexpectedEof { |
| 159 | Ok(DidReadExact::Eof) |
| 160 | } else { |
| 161 | Err(e) |
| 162 | } |
| 163 | }) |
| 164 | } |
| 165 | |
| 166 | /// Get a reference to the [`AsyncBufRead`]'s buffer, filling it if necessary. |
| 167 | pub(super) async fn peek_buf(src: &mut (impl AsyncBufRead + Unpin)) -> io::Result<Option<&[u8]>> { |
no test coverage detected
searching dependent graphs…