Struct cobble_core::minecraft::SaveGame
source · pub struct SaveGame {
pub name: String,
pub path: PathBuf,
pub difficulty: Option<Difficulty>,
pub game_type: GameType,
pub game_version: Option<String>,
pub seed: Option<i64>,
pub last_played: OffsetDateTime,
}
Available on crate feature
save-games
only.Expand description
Represents a single save game.
Fields§
§name: String
Name of the save game
path: PathBuf
Path to the save game
difficulty: Option<Difficulty>
Difficulty of the save game. No value means the difficulty is globally set (older versions).
game_type: GameType
Game type for new players
game_version: Option<String>
Game version the save game was last saved in
seed: Option<i64>
The seed of the save game
last_played: OffsetDateTime
Last played timestamp
Implementations§
source§impl SaveGame
impl SaveGame
sourcepub async fn export(
&self,
dest: impl AsRef<Path>,
compression: u32
) -> CobbleResult<()>
Available on crate feature backup
only.
pub async fn export(
&self,
dest: impl AsRef<Path>,
compression: u32
) -> CobbleResult<()>
backup
only.Exports the save game folder using a gzip compressed tar archive. The compression is a level is an integer from 0-9 where 0 means “no compression” and 9 means “take as long as you’d like”.
sourcepub async fn import(
saves_path: impl AsRef<Path>,
src: impl AsRef<Path>
) -> CobbleResult<Option<SaveGame>>
Available on crate feature backup
only.
pub async fn import(
saves_path: impl AsRef<Path>,
src: impl AsRef<Path>
) -> CobbleResult<Option<SaveGame>>
backup
only.Imports a save game archive.
The archive needs to contain the marker file.
Validates the imported save game and returns None
if the save game could not be parsed.
sourcepub async fn remove(self) -> CobbleResult<()>
pub async fn remove(self) -> CobbleResult<()>
Removes the whole save game folder.
Warning: This will permanently delete the save game!
Trait Implementations§
source§impl<'de> Deserialize<'de> for SaveGame
impl<'de> Deserialize<'de> for SaveGame
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more