pub struct IniFileSystem { /* private fields */ }
Expand description
A hierarchical file system of IniFile.
example usage:
ⓘ
use std::path::PathBuf;
use rpkg_rs::misc::ini_file_system::IniFileSystem;
let retail_path = PathBuf::from("Path to retail folder");
let thumbs_path = retail_path.join("thumbs.dat");
let thumbs = IniFileSystem::from(&thumbs_path.as_path())?;
let app_options = &thumbs.root()?;
if let (Some(proj_path), Some(runtime_path)) = (app_options.get("PROJECT_PATH"), app_options.get("RUNTIME_PATH")) {
println!("Project path: {}", proj_path);
println!("Runtime path: {}", runtime_path);
}
Implementations§
Source§impl IniFileSystem
impl IniFileSystem
pub fn new() -> Self
Sourcepub fn load(&mut self, root_file: impl AsRef<Path>) -> Result<(), IniFileError>
pub fn load(&mut self, root_file: impl AsRef<Path>) -> Result<(), IniFileError>
Loads an IniFileSystem from the given root file.
pub fn from(root_file: impl AsRef<Path>) -> Result<Self, IniFileError>
pub fn write_to_folder<P: AsRef<Path>>( &self, path: P, ) -> Result<(), IniFileError>
Sourcepub fn normalize(&mut self)
pub fn normalize(&mut self)
Normalizes the IniFileSystem by merging sections and console commands from included files into the root file.
Sourcepub fn console_cmds(&self) -> Vec<String>
pub fn console_cmds(&self) -> Vec<String>
Retrieves all console commands from the IniFileSystem, including those from included files.
Trait Implementations§
Source§impl Debug for IniFileSystem
impl Debug for IniFileSystem
Source§impl Default for IniFileSystem
impl Default for IniFileSystem
Source§fn default() -> IniFileSystem
fn default() -> IniFileSystem
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for IniFileSystem
impl<'de> Deserialize<'de> for IniFileSystem
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
Auto Trait Implementations§
impl Freeze for IniFileSystem
impl RefUnwindSafe for IniFileSystem
impl Send for IniFileSystem
impl Sync for IniFileSystem
impl Unpin for IniFileSystem
impl UnwindSafe for IniFileSystem
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
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>
Converts
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>
Converts
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