pub struct SaveBundle {
pub location: PathBuf,
pub name: String,
pub level: i32,
pub players: Vec<String>,
}
Expand description
Represents a REPO Save directory (official or backup) A save bundle contains a .es3 save file of the same name as the bundle folder and optionally other backups of the .es3 file.
Fields§
§location: PathBuf
directory location on disk
name: String
save name
level: i32
save level
players: Vec<String>
player list
Implementations§
Source§impl SaveBundle
A SaveBundle represents how REPO stores a save on the disk.
It’s a directory with a name like REPO_SAVE_2025_04_12_15_39_47
,
containing a save file with the same name and the extension es3
.
For eg. REPO_SAVE_2025_04_12_15_39_47.es3
.
impl SaveBundle
A SaveBundle represents how REPO stores a save on the disk.
It’s a directory with a name like REPO_SAVE_2025_04_12_15_39_47
,
containing a save file with the same name and the extension es3
.
For eg. REPO_SAVE_2025_04_12_15_39_47.es3
.
Sometimes, it will also contain backups of the save with names like
REPO_SAVE_2025_04_12_15_39_47_BACKUP1.es3
.
The backup files are not read.
- REPO_SAVE_2025_04_12_15_39_47
| -- REPO_SAVE_2025_04_12_15_39_47.es3
Sourcepub fn new(location: impl AsRef<Path>) -> Result<Self, SaveBundleError>
pub fn new(location: impl AsRef<Path>) -> Result<Self, SaveBundleError>
Initialise a new SaveBundle object from a save file.
Sourcepub fn get_data(&self) -> Result<SaveGame, SaveBundleError>
pub fn get_data(&self) -> Result<SaveGame, SaveBundleError>
Reads the save file, decrypts it and returns the Deserialised JSON data.
Sourcepub fn refresh_data(&mut self) -> Result<(), SaveBundleError>
pub fn refresh_data(&mut self) -> Result<(), SaveBundleError>
Refresh the save metadata stored in the struct by re-reading the save file. This is useful if the save has been updated since last read.
This method modifies the following fields:
- level
- players
Trait Implementations§
Source§impl Clone for SaveBundle
impl Clone for SaveBundle
Source§fn clone(&self) -> SaveBundle
fn clone(&self) -> SaveBundle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'de> Deserialize<'de> for SaveBundle
impl<'de> Deserialize<'de> for SaveBundle
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>,
Source§impl PartialEq for SaveBundle
impl PartialEq for SaveBundle
Source§impl Serialize for SaveBundle
impl Serialize for SaveBundle
impl StructuralPartialEq for SaveBundle
Auto Trait Implementations§
impl Freeze for SaveBundle
impl RefUnwindSafe for SaveBundle
impl Send for SaveBundle
impl Sync for SaveBundle
impl Unpin for SaveBundle
impl UnwindSafe for SaveBundle
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.