feat(docs): document track_game_with_friendly

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-03-01 22:23:20 -06:00
parent 1c66676994
commit 048ec310c7
1 changed files with 22 additions and 5 deletions

View File

@ -64,7 +64,7 @@ impl Archive {
}
}
/// Adds a path and it's contents to the list of tracked game files
/// Adds a path and its contents to the list of tracked game files
///
/// TODO: Add note here about how GameSaveLocation, GameFile and tracking individual files rather than directories work
///
@ -75,10 +75,10 @@ impl Archive {
/// ```
/// # use client::archive::Archive;
/// let mut archive = Archive::try_default().unwrap();
/// let game_save_path = "/home/user/Documents/generic_company/generic_game/save_folder";
/// match archive.track_game(game_save_path) {
/// Ok(_) => println!("Save Sync is now tracking {}", game_save_path),
/// Err(err) => eprintln!("Failed to track {}: {:?}", game_save_path, err)
/// let save_path = "/home/user/Documents/generic_company/generic_game/save_folder";
/// match archive.track_game(save_path) {
/// Ok(_) => println!("Save Sync is now tracking {}", save_path),
/// Err(err) => eprintln!("Failed to track {}: {:?}", save_path, err)
/// };
/// ```
pub fn track_game<P: AsRef<Path>>(&mut self, path: P) -> Result<(), GameTrackError> {
@ -87,6 +87,23 @@ impl Archive {
Ok(())
}
/// Adds a path and its contents to the list of tracked game files
///
/// TODO: Add similar note to the one in [`track_game`]
///
/// # Arguments
/// * `path` - The path which will be tracked along with any children it may have
///
/// # Examples
/// ```
/// # use client::archive::Archive;
/// let mut archive = Archive::try_default().unwrap();
/// let save_path = "/home/user/Documents/generic_company/generic_game/save_folder";
/// let friendly_name = "Generic Game";
/// match archive.track_game_with_friendly(save_path, friendly_name) {
/// Ok(_) => println!("Save Sync is now tracking {}", friendly_name),
/// Err(err) => eprintln!("Save Sync failed to start tracking {}", friendly_name)
/// };
pub fn track_game_with_friendly<P>(&mut self, path: P, name: &str) -> Result<(), GameTrackError>
where
P: AsRef<Path>,