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),
}
Expand description
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
sourceimpl ParamKind
impl ParamKind
sourcepub fn try_into_owned<T>(self) -> Result<T, T::Error>where
T: TryFrom<ParamKind>,
pub fn try_into_owned<T>(self) -> Result<T, T::Error>where
T: TryFrom<ParamKind>,
Attempts to convert an owned param into the contained value. Returns an error if the contained value is not the expected type.
sourcepub fn try_into_ref<'a, T>(
&'a self
) -> Result<&'a T, <&'a T as TryFrom<&'a ParamKind>>::Error>where
&'a T: TryFrom<&'a ParamKind>,
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>,
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.
sourcepub 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>,
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>,
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.
sourcepub fn unwrap_as_hashmap(self) -> HashMap<Hash40, ParamKind>
pub fn unwrap_as_hashmap(self) -> HashMap<Hash40, ParamKind>
Converts an owned param into a HashMap, indexing into the contained params. Panics if the param was not a ParamKind::Struct.
sourcepub fn unwrap_as_hashmap_ref(&self) -> HashMap<Hash40, &ParamKind>
pub fn unwrap_as_hashmap_ref(&self) -> HashMap<Hash40, &ParamKind>
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.
sourcepub fn unwrap_as_hashmap_mut(&mut self) -> HashMap<Hash40, &mut ParamKind>
pub fn unwrap_as_hashmap_mut(&mut self) -> HashMap<Hash40, &mut ParamKind>
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.