pub struct ResourcePackage { /* private fields */ }
Implementations§
Source§impl ResourcePackage
impl ResourcePackage
Sourcepub fn from_file<P: AsRef<Path> + Copy>(
package_path: P,
) -> Result<Self, ResourcePackageError>
pub fn from_file<P: AsRef<Path> + Copy>( package_path: P, ) -> Result<Self, ResourcePackageError>
Sourcepub fn from_memory(
data: Vec<u8>,
is_patch: bool,
) -> Result<Self, ResourcePackageError>
pub fn from_memory( data: Vec<u8>, is_patch: bool, ) -> Result<Self, ResourcePackageError>
Parses a ResourcePackage from a memory buffer.
§Arguments
data
- The data to parse.is_patch
- Whether the package is a patch package.
Sourcepub fn version(&self) -> PackageVersion
pub fn version(&self) -> PackageVersion
Returns the version of the package.
Sourcepub fn source(&self) -> Option<&ResourcePackageSource>
pub fn source(&self) -> Option<&ResourcePackageSource>
Returns the source of the package.
Sourcepub fn resources(&self) -> &IndexMap<RuntimeResourceID, ResourceInfo>
pub fn resources(&self) -> &IndexMap<RuntimeResourceID, ResourceInfo>
Returns a map of the RuntimeResourceIds and their resource information.
Sourcepub fn has_legacy_references(&self) -> bool
pub fn has_legacy_references(&self) -> bool
Returns whether the package uses the legacy references format.
Sourcepub fn has_unneeded_resource(&self, rrid: &RuntimeResourceID) -> bool
pub fn has_unneeded_resource(&self, rrid: &RuntimeResourceID) -> bool
Returns whether the given resource is an unneeded resource.
§Arguments
rrid
- The resource ID to check.
Sourcepub fn unneeded_resource_ids(&self) -> Vec<&RuntimeResourceID>
pub fn unneeded_resource_ids(&self) -> Vec<&RuntimeResourceID>
Returns a vector of all unneeded resource IDs.
Sourcepub fn read_resource(
&self,
rrid: &RuntimeResourceID,
) -> Result<Vec<u8>, ResourcePackageError>
pub fn read_resource( &self, rrid: &RuntimeResourceID, ) -> Result<Vec<u8>, ResourcePackageError>
Reads the data of a resource from the package into memory.
§Arguments
rrid
- The resource ID of the resource to read.
Trait Implementations§
Source§impl BinRead for ResourcePackage
impl BinRead for ResourcePackage
Source§fn read_options<R: Read + Seek>(
__binrw_generated_var_reader: &mut R,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<Self>
fn read_options<R: Read + Seek>( __binrw_generated_var_reader: &mut R, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<Self>
Source§fn read<R>(reader: &mut R) -> Result<Self, Error>
fn read<R>(reader: &mut R) -> Result<Self, Error>
Read
Self
from the reader using default arguments. Read moreSource§fn read_be<R>(reader: &mut R) -> Result<Self, Error>
fn read_be<R>(reader: &mut R) -> Result<Self, Error>
Read
Self
from the reader using default arguments and assuming
big-endian byte order. Read moreSource§fn read_le<R>(reader: &mut R) -> Result<Self, Error>
fn read_le<R>(reader: &mut R) -> Result<Self, Error>
Read
Self
from the reader using default arguments and assuming
little-endian byte order. Read moreSource§fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
Read
T
from the reader assuming native-endian byte order. Read moreSource§fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Read
Self
from the reader using the given arguments. Read moreSource§fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Read
Self
from the reader, assuming big-endian byte order, using the
given arguments. Read moreSource§impl BinWrite for ResourcePackage
impl BinWrite for ResourcePackage
Source§fn write_options<W: Write + Seek>(
&self,
__binrw_generated_var_writer: &mut W,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<()>
fn write_options<W: Write + Seek>( &self, __binrw_generated_var_writer: &mut W, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<()>
Source§fn write<W>(&self, writer: &mut W) -> Result<(), Error>
fn write<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self
to the writer using default arguments. Read moreSource§fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self
to the writer assuming big-endian byte order. Read moreSource§fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
Write
Self
to the writer assuming little-endian byte order. Read moreSource§fn write_args<W>(
&self,
writer: &mut W,
args: Self::Args<'_>,
) -> Result<(), Error>
fn write_args<W>( &self, writer: &mut W, args: Self::Args<'_>, ) -> Result<(), Error>
Write
Self
to the writer using the given arguments. Read moreSource§impl ReadEndian for ResourcePackage
impl ReadEndian for ResourcePackage
Source§const ENDIAN: EndianKind
const ENDIAN: EndianKind
The endianness of the type.
Source§impl WriteEndian for ResourcePackage
impl WriteEndian for ResourcePackage
Source§const ENDIAN: EndianKind
const ENDIAN: EndianKind
The endianness of the type.
Auto Trait Implementations§
impl Freeze for ResourcePackage
impl RefUnwindSafe for ResourcePackage
impl Send for ResourcePackage
impl Sync for ResourcePackage
impl Unpin for ResourcePackage
impl UnwindSafe for ResourcePackage
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