Struct unrpa_rs::rpa::RenpyArchive
source · [−]pub struct RenpyArchive<'a> { /* private fields */ }
Expand description
Represents the Renpy archive format
Implementations
sourceimpl<'a> RenpyArchive<'a>
impl<'a> RenpyArchive<'a>
sourcepub fn from_file(path: &'a Path) -> Result<Self, RpaError>
pub fn from_file(path: &'a Path) -> Result<Self, RpaError>
Construct a RenpyArchive
from a file on the filesystem
This performs I/O operations as it reads the magic literal and the rest of the file to decode the indices present in the archive.
Errors
An error occurs if either an invalid path
has been provided to the OS, I/O errors occurs during reading the file, the zlib decoding fails, or the serde deserialization process fails.
Panics
This function panics if it either encounters an unsupported RpaVersion
, i.e. a variant not covered in the enum declaration, or the integer parsing while constructing the obfuscation key fails.
sourcepub fn indices_map(&self) -> &RpaIdxColl
pub fn indices_map(&self) -> &RpaIdxColl
Method to get access to the collection data structure of RpaIdx
sourcepub fn list_indices(&self) -> Vec<String>
pub fn list_indices(&self) -> Vec<String>
Lists all the files present in one archive
pub fn path(&self) -> &Path
sourcepub fn extract_files_from_indices(
&mut self,
extract_behaviour: DirExtractBehaviour
) -> Result<(), RpaError>
pub fn extract_files_from_indices(
&mut self,
extract_behaviour: DirExtractBehaviour
) -> Result<(), RpaError>
Extracts all files from the indices and writes them to disk
sourcepub fn read_file_from_archive(
&mut self,
filename: &str
) -> Result<Vec<u8>, RpaError>
pub fn read_file_from_archive(
&mut self,
filename: &str
) -> Result<Vec<u8>, RpaError>
Reads the byte buffer of the specified file in the archive into memory
sourcepub fn write_file(
&mut self,
filepath: &Path,
file_buf: &[u8]
) -> Result<(), RpaError>
pub fn write_file(
&mut self,
filepath: &Path,
file_buf: &[u8]
) -> Result<(), RpaError>
Writes the byte buffer of one file to disk
sourcepub fn estimate_overall_write_speed(&self) -> f32
pub fn estimate_overall_write_speed(&self) -> f32
Calculates an estimation of the overall write speed, in MB/s.
sourcepub fn total_bytes_written(&self) -> usize
pub fn total_bytes_written(&self) -> usize
Returns the total amount of bytes written to disk
sourcepub fn total_bytes_written_duration(&self) -> &Duration
pub fn total_bytes_written_duration(&self) -> &Duration
Returns the duration it took to write all bytes to disk
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for RenpyArchive<'a>
impl<'a> Send for RenpyArchive<'a>
impl<'a> Sync for RenpyArchive<'a>
impl<'a> Unpin for RenpyArchive<'a>
impl<'a> UnwindSafe for RenpyArchive<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more