Struct imperator_save::ImperatorFile
source · [−]pub struct ImperatorFile<'a> { /* private fields */ }
Expand description
Entrypoint for parsing Imperator saves
Only consumes enough data to determine encoding of the file
Implementations
sourceimpl<'a> ImperatorFile<'a>
impl<'a> ImperatorFile<'a>
sourcepub fn from_slice(data: &[u8]) -> Result<ImperatorFile<'_>, ImperatorError>
pub fn from_slice(data: &[u8]) -> Result<ImperatorFile<'_>, ImperatorError>
Creates a Imperator file from a slice of data
sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Returns the size of the file
The size includes the inflated size of the zip
pub fn parse_metadata(&self) -> Result<ImperatorParsedFile<'a>, ImperatorError>
sourcepub fn parse(
&self,
zip_sink: &'a mut Vec<u8>
) -> Result<ImperatorParsedFile<'a>, ImperatorError>
pub fn parse(
&self,
zip_sink: &'a mut Vec<u8>
) -> Result<ImperatorParsedFile<'a>, ImperatorError>
Parses the entire file
If the file is a zip, the zip contents will be inflated into the zip sink before being parsed
Auto Trait Implementations
impl<'a> RefUnwindSafe for ImperatorFile<'a>
impl<'a> Send for ImperatorFile<'a>
impl<'a> Sync for ImperatorFile<'a>
impl<'a> Unpin for ImperatorFile<'a>
impl<'a> UnwindSafe for ImperatorFile<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more