pub struct EnabledMods {
pub client: bool,
pub custom: bool,
pub servers: bool,
pub mods: BTreeMap<String, bool>,
/* private fields */
}Expand description
Represents an enabledmods.json file. Core mods will default to true if not present when deserializing.
Fields§
§client: bool§custom: bool§servers: bool§mods: BTreeMap<String, bool>Implementations§
Source§impl EnabledMods
impl EnabledMods
Sourcepub fn load(path: impl AsRef<Path>) -> Result<Self, ThermiteError>
pub fn load(path: impl AsRef<Path>) -> Result<Self, ThermiteError>
Attempts to read an EnabledMods from the path
§Errors
- The file doesn’t exist
- The file isn’t formatted properly
Sourcepub fn default_with_path(path: impl AsRef<Path>) -> Self
pub fn default_with_path(path: impl AsRef<Path>) -> Self
Returns a default EnabledMods with the path property set
Sourcepub fn save(&self) -> Result<(), ThermiteError>
pub fn save(&self) -> Result<(), ThermiteError>
Saves the file using the path it was loaded from
§Errors
- If the path isn’t set
- If there is an IO error
Sourcepub fn save_with_path(
&mut self,
path: impl AsRef<Path>,
) -> Result<(), ThermiteError>
👎Deprecated since 0.9: prefer explicitly setting the path and then saving
pub fn save_with_path( &mut self, path: impl AsRef<Path>, ) -> Result<(), ThermiteError>
pub fn set_path(&mut self, path: impl Into<Option<PathBuf>>)
Sourcepub fn is_enabled(&self, name: impl AsRef<str>) -> bool
pub fn is_enabled(&self, name: impl AsRef<str>) -> bool
Trait Implementations§
Source§impl Clone for EnabledMods
impl Clone for EnabledMods
Source§fn clone(&self) -> EnabledMods
fn clone(&self) -> EnabledMods
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EnabledMods
impl Debug for EnabledMods
Source§impl Default for EnabledMods
impl Default for EnabledMods
Source§impl<'de> Deserialize<'de> for EnabledMods
impl<'de> Deserialize<'de> for EnabledMods
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
Source§impl Hash for EnabledMods
impl Hash for EnabledMods
Auto Trait Implementations§
impl Freeze for EnabledMods
impl RefUnwindSafe for EnabledMods
impl Send for EnabledMods
impl Sync for EnabledMods
impl Unpin for EnabledMods
impl UnwindSafe for EnabledMods
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
Mutably borrows from an owned value. Read more