use std::borrow::Cow;
use super::Item;
use crate::common::generic_consts::AccessPattern;
use crate::common::universal_io::{ReadRange, Result, UserData};
pub trait BorrowedReadPipeline<'file, T, U>: Sized
where
T: Item,
U: UserData,
{
type File: 'file;
fn new() -> Result<Self>;
fn can_schedule(&mut self) -> bool;
fn schedule<P>(
&mut self,
user_data: U,
file: &'file Self::File,
range: ReadRange,
) -> Result<()>
where
P: AccessPattern;
fn wait(&mut self) -> Result<Option<(U, Cow<'file, [T]>)>>;
}
pub trait OwnedReadPipeline<T, U>: Sized
where
T: bytemuck::Pod,
U: UserData,
{
type File;
fn new(file: Self::File) -> Result<Self>;
fn can_schedule(&mut self) -> bool;
fn schedule<P>(&mut self, user_data: U, range: ReadRange) -> Result<()>
where
P: AccessPattern;
fn schedule_whole(&mut self, user_data: U) -> Result<()>;
fn wait(&mut self) -> Result<Option<(U, Cow<'_, [T]>)>>;
}