use ambassador::delegatable_trait;
use derive_new::new;
#[delegatable_trait]
pub trait FetchStreamAlg<Source: ?Sized = str> {
type Error;
type Stream;
fn open_fetch(&self, source: &Source) -> Result<FetchStream<Self::Stream>, Self::Error>;
fn read_fetch(&self, stream: &mut Self::Stream, buffer: &mut [u8]) -> Result<usize, Self::Error>;
}
#[derive(Debug, new)]
pub struct FetchStream<Stream> {
pub stream: Stream,
pub total: Option<u64>,
}