Struct PartitionManager

Source
pub struct PartitionManager {
    pub partitions: Vec<ResourcePartition>,
    /* private fields */
}

Fields§

§partitions: Vec<ResourcePartition>

Implementations§

Source§

impl PartitionManager

Source

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.
Source

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 call mount_partitions separately
Source

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 call mount_partitions separately
  • progress_callback - A callback function that will be called with the current mounting progress.
Source

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.
Source

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.
Source

pub fn read_resource_from( &self, partition_id: PartitionId, rrid: RuntimeResourceID, ) -> Result<Vec<u8>, PartitionManagerError>

Source

pub fn find_partition( &self, partition_id: PartitionId, ) -> Option<&ResourcePartition>

Source

pub fn root_partition(&self) -> Result<PartitionId, PartitionManagerError>

Source

pub fn partitions_with_resource( &self, rrid: &RuntimeResourceID, ) -> Vec<PartitionId>

Source

pub fn iter_all_runtime_resource_ids( &self, ) -> impl Iterator<Item = &RuntimeResourceID> + '_

Iterates over all RuntimeResourceIDs across all partitions.

§Returns

An iterator yielding references to RuntimeResourceID.

Source

pub fn resource_mounted(&self, rrid: &RuntimeResourceID) -> bool

Source

pub fn resource_infos( &self, rrid: &RuntimeResourceID, ) -> Vec<(PartitionId, &ResourceInfo)>

Source

pub fn resource_info_from( &self, partition_id: &PartitionId, rrid: &RuntimeResourceID, ) -> Result<&ResourceInfo, PartitionManagerError>

Source

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.
Source

pub fn partitions(&self) -> &Vec<ResourcePartition>

👎Deprecated since 1.0.0: prefer direct access through the partitions field
Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.