pub struct ProfileManager { /* private fields */ }Expand description
SQLite-backed profile manager.
Implementations§
Source§impl ProfileManager
impl ProfileManager
Sourcepub async fn open() -> Result<Self>
pub async fn open() -> Result<Self>
Open the profile manager using the configured database backend.
Sourcepub fn with_db(db: ModdeDb) -> Self
pub fn with_db(db: ModdeDb) -> Self
Create a profile manager with a custom database (for testing).
Sourcepub async fn list(&self) -> Result<Vec<ProfileSummary>>
pub async fn list(&self) -> Result<Vec<ProfileSummary>>
List profile summaries, optionally filtered by game.
Sourcepub async fn list_for_game(
&self,
game_id: &GameId,
) -> Result<Vec<ProfileSummary>>
pub async fn list_for_game( &self, game_id: &GameId, ) -> Result<Vec<ProfileSummary>>
List profiles for a specific game.
Sourcepub async fn load(
&self,
name: &str,
game_id: Option<&GameId>,
) -> Result<Profile>
pub async fn load( &self, name: &str, game_id: Option<&GameId>, ) -> Result<Profile>
Load a profile by name. If game_id is None, the name must be unambiguous.
Sourcepub async fn create(&self, profile: &Profile) -> Result<i64>
pub async fn create(&self, profile: &Profile) -> Result<i64>
Create a new profile, returning its database ID.
Sourcepub async fn create_or_update(&self, profile: &Profile) -> Result<i64>
pub async fn create_or_update(&self, profile: &Profile) -> Result<i64>
Create a profile if it doesn’t exist, or update it if it does.
Sourcepub async fn delete(&self, name: &str, game_id: Option<&GameId>) -> Result<()>
pub async fn delete(&self, name: &str, game_id: Option<&GameId>) -> Result<()>
Delete a profile. If game_id is None, the name must be unambiguous.
Sourcepub async fn import_toml(&self, profiles_dir: &Path) -> Result<usize>
pub async fn import_toml(&self, profiles_dir: &Path) -> Result<usize>
Import existing TOML profile files into the database.
Sourcepub fn staging_dir(name: &str) -> PathBuf
pub fn staging_dir(name: &str) -> PathBuf
Staging directory for a profile (still on-disk).
Sourcepub fn default_overrides(name: &str) -> PathBuf
pub fn default_overrides(name: &str) -> PathBuf
Default overrides directory for a profile.
Sourcepub async fn activate(
&self,
name: &str,
game_id: &GameId,
save_dir: Option<&Path>,
) -> Result<ActivateResult>
pub async fn activate( &self, name: &str, game_id: &GameId, save_dir: Option<&Path>, ) -> Result<ActivateResult>
Activate a profile, swapping saves automatically.
save_dir is the game’s save directory (resolved by the caller via
GamePlugin::save_directory()). If None, save swapping is skipped.
fingerprint is the current profile’s mod fingerprint. If provided,
it is embedded in the save vault commit so future restores can warn
about mod mismatches.
If existing saves are detected with no active profile, returns
ActivateResult::AdoptionRequired so the caller can prompt the user.
Sourcepub async fn activate_with_fingerprint(
&self,
name: &str,
game_id: &GameId,
save_dir: Option<&Path>,
fingerprint: Option<&SaveFingerprint>,
) -> Result<ActivateResult>
pub async fn activate_with_fingerprint( &self, name: &str, game_id: &GameId, save_dir: Option<&Path>, fingerprint: Option<&SaveFingerprint>, ) -> Result<ActivateResult>
Activate with an optional mod fingerprint embedded in the save capture.
Sourcepub async fn try_profile(
&self,
name: &str,
game_id: &GameId,
save_dir: Option<&Path>,
) -> Result<()>
pub async fn try_profile( &self, name: &str, game_id: &GameId, save_dir: Option<&Path>, ) -> Result<()>
Try a profile experimentally, pushing the current profile onto the stack.
save_dir is the game’s save directory. If None, save swapping is skipped.
fingerprint is the current profile’s mod fingerprint.
Sourcepub async fn try_profile_with_fingerprint(
&self,
name: &str,
game_id: &GameId,
save_dir: Option<&Path>,
fingerprint: Option<&SaveFingerprint>,
) -> Result<()>
pub async fn try_profile_with_fingerprint( &self, name: &str, game_id: &GameId, save_dir: Option<&Path>, fingerprint: Option<&SaveFingerprint>, ) -> Result<()>
Try a profile experimentally with a mod fingerprint.
Sourcepub async fn rollback(
&self,
game_id: &GameId,
save_dir: Option<&Path>,
) -> Result<String>
pub async fn rollback( &self, game_id: &GameId, save_dir: Option<&Path>, ) -> Result<String>
Roll back to the previous profile on the experiment stack. Returns the name of the profile we rolled back to.
save_dir is the game’s save directory. If None, save swapping is skipped.
fingerprint is the current profile’s mod fingerprint.
Sourcepub async fn rollback_with_fingerprint(
&self,
game_id: &GameId,
save_dir: Option<&Path>,
fingerprint: Option<&SaveFingerprint>,
) -> Result<String>
pub async fn rollback_with_fingerprint( &self, game_id: &GameId, save_dir: Option<&Path>, fingerprint: Option<&SaveFingerprint>, ) -> Result<String>
Roll back with a mod fingerprint.
Sourcepub async fn commit(&self, game_id: &GameId) -> Result<()>
pub async fn commit(&self, game_id: &GameId) -> Result<()>
Accept the current experiment, clearing the experiment stack.
Sourcepub async fn active(
&self,
game_id: &GameId,
) -> Result<Option<ActiveProfileInfo>>
pub async fn active( &self, game_id: &GameId, ) -> Result<Option<ActiveProfileInfo>>
Get the currently active profile and experiment depth for a game.
Sourcepub async fn fork(
&self,
source_name: &str,
new_name: &str,
game_id: &GameId,
) -> Result<i64>
pub async fn fork( &self, source_name: &str, new_name: &str, game_id: &GameId, ) -> Result<i64>
Fork a profile: clone its mods, load order rules, and save branch.
By default this is a faithful copy — both the profile-level
load_order_lock and every per-mod pin ride along. Use
Self::fork_with_options (or modde profile fork --unlock) for
the “fork to diverge” workflow where the new profile starts
unlocked so it can be freely reorganised.
Sourcepub async fn fork_with_options(
&self,
source_name: &str,
new_name: &str,
game_id: &GameId,
options: ForkOptions,
) -> Result<i64>
pub async fn fork_with_options( &self, source_name: &str, new_name: &str, game_id: &GameId, options: ForkOptions, ) -> Result<i64>
Fork a profile with explicit control over whether the new profile
inherits locks. See ForkOptions for the flags.
Auto Trait Implementations§
impl !RefUnwindSafe for ProfileManager
impl !UnwindSafe for ProfileManager
impl Freeze for ProfileManager
impl Send for ProfileManager
impl Sync for ProfileManager
impl Unpin for ProfileManager
impl UnsafeUnpin for ProfileManager
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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