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.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for ParamKind
impl<'de> Deserialize<'de> for ParamKind
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<ParamStruct> for ParamKind
impl From<ParamStruct> for ParamKind
sourcefn from(v: ParamStruct) -> ParamKind
fn from(v: ParamStruct) -> ParamKind
Converts to this type from the input type.
sourceimpl<'a> TryFrom<&'a ParamKind> for &'a ParamStruct
impl<'a> TryFrom<&'a ParamKind> for &'a ParamStruct
sourceimpl<'a> TryFrom<&'a mut ParamKind> for &'a mut ParamStruct
impl<'a> TryFrom<&'a mut ParamKind> for &'a mut ParamStruct
sourceimpl TryFrom<ParamKind> for ParamStruct
impl TryFrom<ParamKind> for ParamStruct
impl StructuralPartialEq for ParamKind
Auto Trait Implementations
impl RefUnwindSafe for ParamKind
impl Send for ParamKind
impl Sync for ParamKind
impl Unpin for ParamKind
impl UnwindSafe for ParamKind
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more