[][src]Struct arma_preset_parser::Preset

pub struct Preset {
    pub name: String,
    pub mods: Vec<Mod>,
}

Preset struct. Stores the preset name and a vector of all the mods

Fields

name: Stringmods: Vec<Mod>

Implementations

impl Preset[src]

pub fn from_file(file: File) -> Result<Self, ParserError>[src]

This function returns a preset from a file object

Examples

match std::fs::File::open(some_path) {
    Ok(file) => {
        match arma_preset_parser::Preset::from_file(file) {
            Ok(preset) => println!("{:?}", preset),
            Err(e) => println!("{}", e)
        };
    },
    Err(e) => println!("{}", e)
};

pub fn from_fs(path: String) -> Result<Self, ParserError>[src]

This function returns a preset from a String filepath

Examples

match arma_preset_parser::Preset::from_fs("some_path".parse().unwrap()) {
    Ok(preset) => println!("{:?}", preset),
    Err(e) => println!("{}", e)
};

pub fn as_mods(&self) -> Vec<Mod>[src]

This function returns a vector of mods from a preset

Examples

match arma_preset_parser::Preset::from_fs("some_path".parse().unwrap()) {
    Ok(preset) => println!("{:?}", preset.as_mods()),
    Err(e) => println!("{}", e)
};

pub fn as_ids(&self) -> Vec<i64>[src]

This function returns a vector of mod ids from a preset

Examples

match arma_preset_parser::Preset::from_fs("some_path".parse().unwrap()) {
    Ok(preset) => println!("{:?}", preset.as_ids()),
    Err(e) => println!("{}", e)
};

pub fn as_names(&self) -> Vec<String>[src]

This function returns a vector of mod names from a preset

Examples

match arma_preset_parser::Preset::from_fs("some_path".parse().unwrap()) {
    Ok(preset) => println!("{:?}", preset.as_names()),
    Err(e) => println!("{}", e)
};

This function returns a vector of mod names from a preset

Examples

match arma_preset_parser::Preset::from_fs("some_path".parse().unwrap()) {
    Ok(preset) => println!("{:?}", preset.as_links()),
    Err(e) => println!("{}", e)
};

Trait Implementations

impl Debug for Preset[src]

impl PartialEq<Preset> for Preset[src]

impl StructuralPartialEq for Preset[src]

Auto Trait Implementations

impl RefUnwindSafe for Preset

impl Send for Preset

impl Sync for Preset

impl Unpin for Preset

impl UnwindSafe for Preset

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.