pub struct PartitionManager {
pub partitions: Vec<ResourcePartition>,
/* private fields */
}
Fields§
§partitions: Vec<ResourcePartition>
Implementations§
Source§impl PartitionManager
impl PartitionManager
Sourcepub fn new(
runtime_directory: PathBuf,
package_definition: &PackageDefinitionSource,
) -> Result<Self, PartitionManagerError>
pub fn new( runtime_directory: PathBuf, package_definition: &PackageDefinitionSource, ) -> Result<Self, PartitionManagerError>
Create a new PartitionManager for the game at the given path, and a custom package definition.
§Arguments
runtime_directory
- The path to the game’s runtime directory.package_definition
- The package definition to use.
Sourcepub fn from_game(
retail_directory: PathBuf,
game_version: WoaVersion,
mount: bool,
) -> Result<Self, PartitionManagerError>
pub fn from_game( retail_directory: PathBuf, game_version: WoaVersion, mount: bool, ) -> Result<Self, PartitionManagerError>
Create a new PartitionManager by mounting the game at the given path.
§Arguments
retail_path
- The path to the game’s retail directory.game_version
- The version of the game.mount
- Indicates whether to automatically mount the partitions, can eliminate the need to callmount_partitions
separately
Sourcepub fn from_game_with_callback<F>(
retail_directory: PathBuf,
game_version: WoaVersion,
mount: bool,
progress_callback: F,
) -> Result<Self, PartitionManagerError>
pub fn from_game_with_callback<F>( retail_directory: PathBuf, game_version: WoaVersion, mount: bool, progress_callback: F, ) -> Result<Self, PartitionManagerError>
Create a new PartitionManager by mounting the game at the given path.
§Arguments
retail_path
- The path to the game’s retail directory.game_version
- The version of the game.mount
- Indicates whether to automatically mount the partitions, can eliminate the need to callmount_partitions
separatelyprogress_callback
- A callback function that will be called with the current mounting progress.
Sourcepub fn mount_partitions<F>(
&mut self,
progress_callback: F,
) -> Result<(), PartitionManagerError>
pub fn mount_partitions<F>( &mut self, progress_callback: F, ) -> Result<(), PartitionManagerError>
Mount all the partitions in the game.
§Arguments
progress_callback
- A callback function that will be called with the current mounting progress.
Sourcepub fn mount_partition<F>(
&mut self,
partition_info: PartitionInfo,
progress_callback: F,
) -> Result<(), PartitionManagerError>where
F: FnMut(&PartitionState),
pub fn mount_partition<F>(
&mut self,
partition_info: PartitionInfo,
progress_callback: F,
) -> Result<(), PartitionManagerError>where
F: FnMut(&PartitionState),
Mount a single partition in the game.
§Arguments
partition_info
- The partition info to mount.progress_callback
- A callback function that will be called with the current mounting progress.
pub fn read_resource_from( &self, partition_id: PartitionId, rrid: RuntimeResourceID, ) -> Result<Vec<u8>, PartitionManagerError>
pub fn find_partition( &self, partition_id: PartitionId, ) -> Option<&ResourcePartition>
pub fn root_partition(&self) -> Result<PartitionId, PartitionManagerError>
pub fn partitions_with_resource( &self, rrid: &RuntimeResourceID, ) -> Vec<PartitionId>
Sourcepub fn iter_all_runtime_resource_ids(
&self,
) -> impl Iterator<Item = &RuntimeResourceID> + '_
pub fn iter_all_runtime_resource_ids( &self, ) -> impl Iterator<Item = &RuntimeResourceID> + '_
Iterates over all RuntimeResourceID
s across all partitions.
§Returns
An iterator yielding references to RuntimeResourceID
.
pub fn resource_mounted(&self, rrid: &RuntimeResourceID) -> bool
pub fn resource_infos( &self, rrid: &RuntimeResourceID, ) -> Vec<(PartitionId, &ResourceInfo)>
pub fn resource_info_from( &self, partition_id: &PartitionId, rrid: &RuntimeResourceID, ) -> Result<&ResourceInfo, PartitionManagerError>
Sourcepub fn resolve_resource_from(
&self,
partition_id: PartitionId,
resource_id: &RuntimeResourceID,
) -> Result<(&ResourceInfo, PartitionId), PartitionManagerError>
pub fn resolve_resource_from( &self, partition_id: PartitionId, resource_id: &RuntimeResourceID, ) -> Result<(&ResourceInfo, PartitionId), PartitionManagerError>
Resolves a resource by traversing the partition hierarchy.
§Arguments
partition_id
- The ID of the partition to start resolving from.resource_id
- The ID of the resource to resolve.
pub fn partitions(&self) -> &Vec<ResourcePartition>
👎Deprecated since 1.0.0: prefer direct access through the partitions field
pub fn print_resource_changelog(&self, rrid: &RuntimeResourceID)
👎Deprecated since 1.1.0: please implement this yourself, it is out of scope for this struct
Auto Trait Implementations§
impl Freeze for PartitionManager
impl RefUnwindSafe for PartitionManager
impl Send for PartitionManager
impl Sync for PartitionManager
impl Unpin for PartitionManager
impl UnwindSafe for PartitionManager
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