pub enum FileLoader<'a> {
Api(Box<ApiRepo>),
ApiWithTransformer {
base: Box<ApiRepo>,
transformer: Box<ApiRepo>,
},
Dduf(ZipArchive<&'a mut Cursor<Mmap>>),
}
Variants§
Implementations§
source§impl<'a> FileLoader<'a>
impl<'a> FileLoader<'a>
pub fn from_model_source( source: &'a mut ModelSource, silent: bool, token: TokenSource, revision: Option<String>, ) -> Result<Self>
pub fn list_files(&mut self) -> Result<Vec<String>>
pub fn list_transformer_files(&self) -> Result<Option<Vec<String>>>
sourcepub fn read_file(
&mut self,
name: &str,
from_transformer: bool,
) -> Result<FileData>
pub fn read_file( &mut self, name: &str, from_transformer: bool, ) -> Result<FileData>
Read a file.
- If loading from a DDUF file, this returns indices to the file data instead of owned data.
- For non-DDUF model sources, a path is returned
- File data should be read with
read_to_string
sourcepub fn read_file_copied(
&mut self,
name: &str,
from_transformer: bool,
) -> Result<FileData>
pub fn read_file_copied( &mut self, name: &str, from_transformer: bool, ) -> Result<FileData>
Read a file, always returning owned data.
- If loading from a DDUF file, this copies the file data.
- For non-DDUF model sources, this is equivalent to
read_file
- File data can always be read with
read_to_string_owned
, unlike fromread_file
Auto Trait Implementations§
impl<'a> Freeze for FileLoader<'a>
impl<'a> !RefUnwindSafe for FileLoader<'a>
impl<'a> Send for FileLoader<'a>
impl<'a> Sync for FileLoader<'a>
impl<'a> Unpin for FileLoader<'a>
impl<'a> !UnwindSafe for FileLoader<'a>
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more