[][src]Struct genie_hki::HotkeyInfoMetadata

pub struct HotkeyInfoMetadata(_);

A list of information about hotkey groups in a hotkey file. The length is the number of groups in the file. Each StringKey in the list is the key of the string that names the group. The key is stored at the group's offset index in the hotkey file.

Implementations

impl HotkeyInfoMetadata[src]

pub fn new() -> Self[src]

Returns an empty HotkeyInfoMetadata struct.

Examples

use genie_hki::HotkeyInfoMetadata;

let him = HotkeyInfoMetadata::new();

pub fn add(&mut self, sk: StringKey)[src]

Adds a group to the metadata.

Examples

use genie_hki::HotkeyInfoMetadata;
use genie_lang::StringKey;

let mut him = HotkeyInfoMetadata::new();
him.add(StringKey::from(0u32));

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

Returns the number of groups described by this metadata.

Examples

use genie_hki::HotkeyInfoMetadata;
use genie_lang::StringKey;

let mut him = HotkeyInfoMetadata::new();
assert_eq!(0, him.len());
him.add(StringKey::from(0u32));
assert_eq!(1, him.len());

pub fn is_empty(&self) -> bool[src]

Returns true if this metadata does not contain any groups.

Examples

use genie_hki::HotkeyInfoMetadata;
use genie_lang::StringKey;

let mut him = HotkeyInfoMetadata::new();
assert!(him.is_empty());
him.add(StringKey::from(0u32));
assert!(!him.is_empty());

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

Returns Some(sk), where sk is the string key of the group at the given index. Returns None if no group is located at index, that is, if index >= self.len().

Examples

use genie_hki::HotkeyInfoMetadata;
use genie_lang::StringKey;

let mut him = HotkeyInfoMetadata::new();
assert_eq!(None, him.get(0));
him.add(StringKey::from(0u32));
assert_eq!(Some(&StringKey::from(0u32)), him.get(0));

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

Returns an iterator over the hotkey group metadata contained in this hotkey file's data.

Examples

use genie_hki::HotkeyInfoMetadata;
use genie_lang::StringKey;

let mut him = HotkeyInfoMetadata::new();
him.add(StringKey::from(0u32));
him.add(StringKey::from(1u32));
let mut iter = him.iter();
assert_eq!(Some(&StringKey::from(0u32)), iter.next());
assert_eq!(Some(&StringKey::from(1u32)), iter.next());
assert_eq!(None, iter.next());

Trait Implementations

impl Clone for HotkeyInfoMetadata[src]

impl Debug for HotkeyInfoMetadata[src]

impl Default for HotkeyInfoMetadata[src]

impl Eq for HotkeyInfoMetadata[src]

impl From<Vec<StringKey>> for HotkeyInfoMetadata[src]

impl IntoIterator for HotkeyInfoMetadata[src]

type Item = StringKey

The type of the elements being iterated over.

type IntoIter = IntoIter<StringKey>

Which kind of iterator are we turning this into?

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

type Item = &'a StringKey

The type of the elements being iterated over.

type IntoIter = Iter<'a, StringKey>

Which kind of iterator are we turning this into?

impl PartialEq<HotkeyInfoMetadata> for HotkeyInfoMetadata[src]

impl StructuralEq for HotkeyInfoMetadata[src]

impl StructuralPartialEq for HotkeyInfoMetadata[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, 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.