Config

Struct Config 

Source
pub struct Config(pub HaxeVersion);
Expand description

A basic representation of a libmask configuration.

Tuple Fields§

§0: HaxeVersion

Implementations§

Source§

impl Config

Source

pub fn new(path: Option<&str>) -> Result<Config, Error>

This reads a sample configuration from the disk, and returns it if it’s valid as a Result.

Source

pub fn path(config_location: &str) -> Result<&Path, Error>

Checks a configuration path’s validity and whether or not it exists, returning the path if it exists.

Configuration paths are typically encased in Options to simulate default parameters, where leaving None as the value results in the fallback path, .mask, being used. This method will instead return the raw path through a Result, as this method internally uses Path.try_exists.

Source

pub fn read_from_file(supposed_path: &str) -> Result<String, Error>

Reads a file from a disk, returning its contents according to read_to_string.

Source

pub fn write(path: Option<&str>, version: &str) -> Result<(), Error>

Writes the configuration to a specified path.

Source

pub fn safe_write(path: Option<&str>, version: &str) -> Result<(), Error>

Operates under the same conditions as write, except checking the Haxe version’s existence beforehand.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Config

Available on debug-assertions enabled only.
Source§

fn default() -> Config

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.