pub enum HkValue {
String(String),
Number(f64),
Bool(bool),
Array(Vec<HkValue>),
Map(IndexMap<String, HkValue>),
}Expand description
Enum for values in the .hk config: supports strings, numbers, booleans, arrays, and maps.
Variants§
Implementations§
Source§impl HkValue
impl HkValue
Sourcepub fn as_string(&self) -> Result<String, HkError>
pub fn as_string(&self) -> Result<String, HkError>
Returns the value as a String.
FIX: Automatically converts Numbers and Bools to their string representation instead of returning a TypeMismatch error. This handles cases like ‘version => 0.2’.
pub fn as_number(&self) -> Result<f64, HkError>
pub fn as_bool(&self) -> Result<bool, HkError>
pub fn as_array(&self) -> Result<&Vec<HkValue>, HkError>
pub fn as_map(&self) -> Result<&IndexMap<String, HkValue>, HkError>
Trait Implementations§
impl StructuralPartialEq for HkValue
Auto Trait Implementations§
impl Freeze for HkValue
impl RefUnwindSafe for HkValue
impl Send for HkValue
impl Sync for HkValue
impl Unpin for HkValue
impl UnwindSafe for HkValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more