pub struct Eu4File<'a> { /* private fields */ }Expand description
Entrypoint for parsing EU4 saves
EU4 saves are files that contain a “EU4txt” or “EU4bin” header or contains files within a zip.
Only consumes enough data to determine encoding of the file
Implementations§
Source§impl<'a> Eu4File<'a>
impl<'a> Eu4File<'a>
Sourcepub fn from_slice(data: &[u8]) -> Result<Eu4File<'_>, Eu4Error>
pub fn from_slice(data: &[u8]) -> Result<Eu4File<'_>, Eu4Error>
Creates an EU4 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
Sourcepub fn deserializer(&self) -> Eu4SaveDeserializer<'_, '_>
pub fn deserializer(&self) -> Eu4SaveDeserializer<'_, '_>
A convenience method for creating Eu4Save
Sourcepub fn parse(
&self,
zip_sink: &'a mut Vec<u8>,
) -> Result<Eu4ParsedFile<'a>, Eu4Error>
pub fn parse( &self, zip_sink: &'a mut Vec<u8>, ) -> Result<Eu4ParsedFile<'a>, Eu4Error>
Parses the entire file
If the file is a zip, the zip contents will be inflated into the zip sink before being parsed
Sourcepub fn entries(&self) -> Eu4FileEntries<'_>
pub fn entries(&self) -> Eu4FileEntries<'_>
Iterates through the individual entries of the Eu4 file
Non-zips will yield a single entry
Auto Trait Implementations§
impl<'a> Freeze for Eu4File<'a>
impl<'a> RefUnwindSafe for Eu4File<'a>
impl<'a> Send for Eu4File<'a>
impl<'a> Sync for Eu4File<'a>
impl<'a> Unpin for Eu4File<'a>
impl<'a> UnwindSafe for Eu4File<'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