pub struct DataLoader<F> { /* private fields */ }Expand description
Data loader, to load data from files
Implementations§
Source§impl<F: DataFormatHandler> DataLoader<F>
impl<F: DataFormatHandler> DataLoader<F>
Sourcepub fn load_file<T: Data>(&mut self, path: impl AsRef<Path>) -> DataReceiver<T> ⓘ
pub fn load_file<T: Data>(&mut self, path: impl AsRef<Path>) -> DataReceiver<T> ⓘ
Load Data from a file
Sourcepub fn load_map<M: DataMapper>(
&mut self,
path: impl AsRef<Path>,
mapper: M,
) -> DataReceiver<M::Out> ⓘ
pub fn load_map<M: DataMapper>( &mut self, path: impl AsRef<Path>, mapper: M, ) -> DataReceiver<M::Out> ⓘ
Load and map data from a file
Sourcepub fn load_map_cached<M: DataMapper>(
&mut self,
path: impl AsRef<Path>,
mapper: M,
) -> DataReceiver<M::Out> ⓘ
pub fn load_map_cached<M: DataMapper>( &mut self, path: impl AsRef<Path>, mapper: M, ) -> DataReceiver<M::Out> ⓘ
Load and map data from a file, but cache the result so the mapper is only invoked if the file has changed
Sourcepub fn load<Out: Send + 'static>(
&mut self,
path: &Path,
f: impl FnOnce(&Path) -> Result<Out> + Send + 'static,
) -> DataReceiver<Out> ⓘ
pub fn load<Out: Send + 'static>( &mut self, path: &Path, f: impl FnOnce(&Path) -> Result<Out> + Send + 'static, ) -> DataReceiver<Out> ⓘ
Loads data from a given path, with a custom Out type
Sourcepub fn load_all_files<T: Data, P: AsRef<Path>>(
&mut self,
paths: impl Iterator<Item = P>,
) -> DataReceiver<Vec<T>> ⓘ
pub fn load_all_files<T: Data, P: AsRef<Path>>( &mut self, paths: impl Iterator<Item = P>, ) -> DataReceiver<Vec<T>> ⓘ
Load all files from a given iterator of paths
Sourcepub fn load_all_mapped<M: DataMapper + Clone, P: AsRef<Path>>(
&mut self,
paths: impl Iterator<Item = P>,
mapper: M,
) -> DataReceiver<Vec<M::Out>> ⓘ
pub fn load_all_mapped<M: DataMapper + Clone, P: AsRef<Path>>( &mut self, paths: impl Iterator<Item = P>, mapper: M, ) -> DataReceiver<Vec<M::Out>> ⓘ
Load all files from a given iterator of paths, with a custom mapper
Auto Trait Implementations§
impl<F> Freeze for DataLoader<F>
impl<F> RefUnwindSafe for DataLoader<F>where
F: RefUnwindSafe,
impl<F> Send for DataLoader<F>where
F: Send,
impl<F> Sync for DataLoader<F>where
F: Sync,
impl<F> Unpin for DataLoader<F>where
F: Unpin,
impl<F> UnwindSafe for DataLoader<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more