[][src]Enum genie_support::StringKey

pub enum StringKey {
    Num(u32),
    Name(String),
}

A key in a language file.

A key may be either a nonnegative integer or an arbitrary string.

The original game supports only nonnegative integers. The HD Edition allows for integers as well as Strings to serve as keys in a key value file.

Variants

Num(u32)

An integer string key.

Name(String)

A named string key. The string must not represent a u32 value (such keys must be Num).

Implementations

impl StringKey[src]

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

Returns true if and only if this StringKey is a number.

Examples

use genie_support::StringKey;
use std::convert::TryFrom;
assert!(StringKey::try_from(0).unwrap().is_numeric());
assert!(!StringKey::from("").is_numeric());

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

Returns true if and only if this StringKey is a string name.

Examples

use genie_support::StringKey;
use std::convert::TryFrom;
assert!(!StringKey::try_from(0).unwrap().is_named());
assert!(StringKey::from("").is_named());

Trait Implementations

impl Clone for StringKey[src]

impl Debug for StringKey[src]

impl Default for StringKey[src]

impl Display for StringKey[src]

impl Eq for StringKey[src]

impl<'_> From<&'_ str> for StringKey[src]

impl From<String> for StringKey[src]

impl From<u16> for StringKey[src]

impl From<u32> for StringKey[src]

impl Hash for StringKey[src]

impl PartialEq<StringKey> for StringKey[src]

impl StructuralEq for StringKey[src]

impl StructuralPartialEq for StringKey[src]

impl<'_> TryFrom<&'_ StringKey> for u32[src]

type Error = TryFromStringKeyError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ StringKey> for i32[src]

type Error = TryFromStringKeyError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ StringKey> for u16[src]

type Error = TryFromStringKeyError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ StringKey> for i16[src]

type Error = TryFromStringKeyError

The type returned in the event of a conversion error.

impl TryFrom<i16> for StringKey[src]

type Error = TryFromIntError

The type returned in the event of a conversion error.

impl TryFrom<i32> for StringKey[src]

type Error = TryFromIntError

The type returned in the event of a conversion error.

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<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.