[][src]Struct genie_hki::HotkeyGroup

pub struct HotkeyGroup { /* fields omitted */ }

Represents a group of Hotkeys.

Different groups may have different numbers of hotkeys.

Implementations

impl HotkeyGroup[src]

pub fn hotkey(&self, index: usize) -> Option<&Hotkey>[src]

Returns an immutable reference to a single hotkey, if that hotkey is present in this HotkeyGroup.

pub fn hotkey_mut(&mut self, index: usize) -> Option<&mut Hotkey>[src]

Get a mutable reference to a single hotkey. This way, you can edit or replace the mapping.

pub fn unbind(&self, index: usize) -> Result<Self, HotkeyIndexError>[src]

Returns a hotkey group equivalent to this group but with the hotkey at index unbound so that the key is 0 and all modifier keys are false. Returns an error if the index does not exist.

pub fn bind(
    &self,
    index: usize,
    key: i32,
    ctrl: bool,
    alt: bool,
    shift: bool
) -> Result<Self, HotkeyIndexError>
[src]

Returns a hotkey group equivalent to this group but with the hotkey at index bound with the given key and modifier keys. Returns an error if the index does not exist.

pub fn num_hotkeys(&self) -> usize[src]

Returns the number of hotkeys in this HotkeyGroup.

use std::fs::File;
use genie_hki::HotkeyInfo;
let mut f = File::open("test/files/aoc1.hki")?;
let info = HotkeyInfo::from(&mut f)?;
// Villager hotkeys are group 3 in AoC and HD Edition.
let group = info.group(3).expect("file does not contain villager hotkeys");
assert_eq!(28, group.num_hotkeys());

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

Returns an iterator over this group's hotkeys.

pub fn to_string_lang(&self, lang_file: &LangFile, sk: &StringKey) -> String[src]

Returns a string representation of this hotkey group, using the strings from lang_file and the group name string key sk.

Trait Implementations

impl Clone for HotkeyGroup[src]

impl Debug for HotkeyGroup[src]

impl Display for HotkeyGroup[src]

impl Eq for HotkeyGroup[src]

impl IntoIterator for HotkeyGroup[src]

type Item = Hotkey

The type of the elements being iterated over.

type IntoIter = IntoIter<Hotkey>

Which kind of iterator are we turning this into?

impl<'a> IntoIterator for &'a HotkeyGroup[src]

type Item = &'a Hotkey

The type of the elements being iterated over.

type IntoIter = Iter<'a, Hotkey>

Which kind of iterator are we turning this into?

impl<'a> IntoIterator for &'a mut HotkeyGroup[src]

type Item = &'a mut Hotkey

The type of the elements being iterated over.

type IntoIter = IterMut<'a, Hotkey>

Which kind of iterator are we turning this into?

impl PartialEq<HotkeyGroup> for HotkeyGroup[src]

impl StructuralEq for HotkeyGroup[src]

impl StructuralPartialEq for HotkeyGroup[src]

Auto Trait Implementations

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<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.