Enum prc::param::ParamKind[][src]

pub enum ParamKind {
    Bool(bool),
    I8(i8),
    U8(u8),
    I16(i16),
    U16(u16),
    I32(i32),
    U32(u32),
    Float(f32),
    Hash(Hash40),
    Str(String),
    List(ParamList),
    Struct(ParamStruct),
}

The central data structure to param files and params. Similar to tree-like recursive data formats such as JSON.

Variants

Bool(bool)
I8(i8)
U8(u8)
I16(i16)
U16(u16)
I32(i32)
U32(u32)
Float(f32)
Hash(Hash40)
Str(String)
List(ParamList)
Struct(ParamStruct)

Implementations

impl ParamKind[src]

pub fn try_into_owned<T>(self) -> Result<T, T::Error> where
    T: TryFrom<ParamKind>, 
[src]

Attempts to convert an owned param into the contained value. Returns an error if the contained value is not the expected type.

pub fn try_into_ref<'a, T>(
    &'a self
) -> Result<&'a T, <&'a T as TryFrom<&'a ParamKind>>::Error> where
    &'a T: TryFrom<&'a ParamKind>, 
[src]

Attempts to convert a param by reference into a reference of the contained value. Returns an error if the contained value is not the expected type.

pub fn try_into_mut<'a, T>(
    &'a mut self
) -> Result<&'a mut T, <&'a mut T as TryFrom<&'a mut ParamKind>>::Error> where
    &'a mut T: TryFrom<&'a mut ParamKind>, 
[src]

Attempts to convert a param by mutable reference into a mutable reference of the contained value. Returns an error if the contained value is not the expected type.

pub fn unwrap_as_hashmap(self) -> HashMap<Hash40, ParamKind>[src]

Converts an owned param into a HashMap, indexing into the contained params. Panics if the param was not a ParamKind::Struct.

pub fn unwrap_as_hashmap_ref(&self) -> HashMap<Hash40, &ParamKind>[src]

Converts a reference to a param into a HashMap, indexing into references to the contained params. Panics if the param was not a ParamKind::Struct.

pub fn unwrap_as_hashmap_mut(&mut self) -> HashMap<Hash40, &mut ParamKind>[src]

Converts a mutable reference to a param into a HashMap, indexing into mutable references to the contained params. Panics if the param was not a ParamKind::Struct.

Trait Implementations

impl Clone for ParamKind[src]

impl Debug for ParamKind[src]

impl<'de> Deserialize<'de> for ParamKind[src]

impl From<Hash40> for ParamKind[src]

impl From<ParamList> for ParamKind[src]

impl From<ParamStruct> for ParamKind[src]

impl From<String> for ParamKind[src]

impl From<bool> for ParamKind[src]

impl From<f32> for ParamKind[src]

impl From<i16> for ParamKind[src]

impl From<i32> for ParamKind[src]

impl From<i8> for ParamKind[src]

impl From<u16> for ParamKind[src]

impl From<u32> for ParamKind[src]

impl From<u8> for ParamKind[src]

impl PartialEq<ParamKind> for ParamKind[src]

impl Serialize for ParamKind[src]

impl StructuralPartialEq for ParamKind[src]

impl<'a> TryFrom<&'a ParamKind> for &'a ParamList[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a ParamKind> for &'a ParamStruct[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a mut ParamKind> for &'a mut ParamList[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl<'a> TryFrom<&'a mut ParamKind> for &'a mut ParamStruct[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<ParamKind> for ParamList[src]

type Error = &'static str

The type returned in the event of a conversion error.

impl TryFrom<ParamKind> for ParamStruct[src]

type Error = &'static str

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[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, 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.