(r: &mut T)
| 230 | pub use async_impls::AsyncCompressReader; |
| 231 | |
| 232 | pub async fn segment_len<T: AsyncSeek + Unpin>(r: &mut T) -> tokio::io::Result<u64> { |
| 233 | use tokio::io::AsyncSeekExt; |
| 234 | let old_pos = r.stream_position().await?; |
| 235 | let len = r.seek(tokio::io::SeekFrom::End(0)).await?; |
| 236 | // If we're already at the end of the file, avoid seeking. |
| 237 | if old_pos != len { |
| 238 | r.seek(tokio::io::SeekFrom::Start(old_pos)).await?; |
| 239 | } |
| 240 | |
| 241 | Ok(len) |
| 242 | } |
| 243 | |
| 244 | mod async_impls { |
| 245 | use super::*; |
no test coverage detected
searching dependent graphs…