///|
/// Get a value from a table by key
pub fn TomlValue::get(self : TomlValue, key : String) -> TomlValue? {
match self {
Table(map) => map.get(key)
_ => None
}
}
///|
/// Convert TomlValue to String
pub fn TomlValue::as_string(self : TomlValue) -> String? {
match self {
String(s) => Some(s)
_ => None
}
}
///|
/// Convert TomlValue to Int64
pub fn TomlValue::as_int(self : TomlValue) -> Int64? {
match self {
Integer(i) => Some(i)
_ => None
}
}
///|
/// Convert TomlValue to Double
pub fn TomlValue::as_float(self : TomlValue) -> Double? {
match self {
Float(f) => Some(f)
_ => None
}
}
///|
/// Convert TomlValue to Bool
pub fn TomlValue::as_bool(self : TomlValue) -> Bool? {
match self {
Boolean(b) => Some(b)
_ => None
}
}
///|
/// Convert TomlValue to Array
pub fn TomlValue::as_array(self : TomlValue) -> Array[TomlValue]? {
match self {
Array(arr) => Some(arr)
_ => None
}
}
///|
/// Convert TomlValue to Table
pub fn TomlValue::as_table(self : TomlValue) -> Map[String, TomlValue]? {
match self {
Table(t) => Some(t)
_ => None
}
}