[][src]Struct genie_lang::LangFile

pub struct LangFile { /* fields omitted */ }

A file containing language strings.

Methods

impl LangFile[src]

pub fn from_dll(input: impl Read) -> Result<Self, LoadError>[src]

Read a language file from a .DLL.

This eagerly loads all the strings into memory.

pub fn from_ini(input: impl Read) -> Result<Self, LoadError>[src]

Read a language file from a .INI file, like the ones used by Voobly and the aoc-language-ini mod.

This eagerly loads all the strings into memory. At this time, the encoding of the language.ini file is assumed to be Windows codepage 1252.

pub fn from_keyval(input: impl Read) -> Result<Self, LoadError>[src]

Read a language file from an HD Edition-style key-value file.

This eagerly loads all the strings into memory.

pub fn get(&self, index: u32) -> Option<&str>[src]

Get a string by its numeric index.

pub fn get_named(&self, name: &str) -> Option<&str>[src]

Get a string by name (HD Edition only).

pub fn set(&mut self, index: u32, value: impl Into<String>)[src]

Set a string at the given numeric index.

pub fn set_named(&mut self, name: &str, value: impl Into<String>)[src]

Set a string by name.

pub fn del(&mut self, index: u32) -> Option<String>[src]

Delete a string by its numeric index.

Returns the string if it previously existed.

pub fn del_named(&mut self, name: &str) -> Option<String>[src]

Delete a string by name.

Returns the string if it previously existed.

pub fn iter(&self) -> impl Iterator<Item = (u32, &str)>[src]

Get an iterator over all the numerically indexed strings.

pub fn iter_named(&self) -> impl Iterator<Item = (&str, &str)>[src]

Get an iterator over all the named strings.

pub fn write_to_ini<W: Write>(&self, output: &mut W) -> Result<()>[src]

pub fn write_to_keyval<W: Write>(&self, output: &mut W) -> Result<()>[src]

Trait Implementations

impl Default for LangFile[src]

impl Debug for LangFile[src]

Auto Trait Implementations

impl Send for LangFile

impl Sync for LangFile

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.