betterstreams/
lib.rs

1//! Library to make working with streams a bit less painful.
2use std::io;
3
4use bytes::Bytes;
5use futures::Stream;
6
7pub mod fs;
8pub mod util;
9
10/// A boxed stream of [`Bytes`] that can be unpinned.
11///
12/// [`Bytes`]: bytes::Bytes
13pub type UnpinDynIoStream =
14    Box<dyn Stream<Item = Result<Bytes, io::Error>> + Send + Sync + Unpin + 'static>;
15
16/// A boxed stream of [`Bytes`].
17///
18/// [`Bytes`]: bytes::Bytes
19pub type DynIoStream = Box<dyn Stream<Item = Result<Bytes, io::Error>> + Send + Sync + 'static>;
20
21/// A stream that can be part of a larger file.
22pub struct ChunkedStreamInfo {
23    /// The stream data.
24    pub stream: DynIoStream,
25
26    /// The size of the current stream chunk, in bytes.
27    pub chunk_size: u64,
28
29    /// The total size of the file the stream was extracted from, in bytes.
30    pub total_size: u64,
31}