pub enum KdlValue {
RawString(String),
String(String),
Base2(i64),
Base8(i64),
Base10(i64),
Base10Float(f64),
Base16(i64),
Bool(bool),
Null,
}
Expand description
A specific KDL Value.
Variants
RawString(String)
String(String)
A KDL String.
Base2(i64)
A KDL
Number in
binary form (e.g. 0b010101
).
Base8(i64)
A KDL
Number in
octal form (e.g. 0o12345670
).
Base10(i64)
A KDL
Number in
decimal form (e.g. 1234567890
).
Base10Float(f64)
A KDL
Number in
decimal form (e.g. 1234567890.123
), interpreted as a Rust f64.
Base16(i64)
A KDL
Number in
hexadecimal form (e.g. 1234567890abcdef
).
Bool(bool)
A KDL Boolean.
Null
The KDL Null Value.
Implementations
sourceimpl KdlValue
impl KdlValue
sourcepub fn is_raw_string(&self) -> bool
pub fn is_raw_string(&self) -> bool
Returns true
if the value is a KdlValue::RawString
.
sourcepub fn is_string(&self) -> bool
pub fn is_string(&self) -> bool
Returns true
if the value is a KdlValue::String
.
sourcepub fn is_string_value(&self) -> bool
pub fn is_string_value(&self) -> bool
Returns true
if the value is a KdlValue::String
or KdlValue::RawString
.
sourcepub fn is_base2(&self) -> bool
pub fn is_base2(&self) -> bool
Returns true
if the value is a KdlValue::Base2
.
sourcepub fn is_base8(&self) -> bool
pub fn is_base8(&self) -> bool
Returns true
if the value is a KdlValue::Base8
.
sourcepub fn is_base10(&self) -> bool
pub fn is_base10(&self) -> bool
Returns true
if the value is a KdlValue::Base10
.
sourcepub fn is_base16(&self) -> bool
pub fn is_base16(&self) -> bool
Returns true
if the value is a KdlValue::Base16
.
sourcepub fn is_i64_value(&self) -> bool
pub fn is_i64_value(&self) -> bool
Returns true
if the value is a KdlValue::Base2
,
KdlValue::Base8
, KdlValue::Base10
, or KdlValue::Base16
.
sourcepub fn is_base10_float(&self) -> bool
pub fn is_base10_float(&self) -> bool
Returns true
if the value is a KdlValue::Base10Float
.
sourcepub fn is_float_value(&self) -> bool
pub fn is_float_value(&self) -> bool
Returns true
if the value is a KdlValue::Base10Float
.
sourcepub fn is_bool(&self) -> bool
pub fn is_bool(&self) -> bool
Returns true
if the value is a KdlValue::Bool
.
sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Returns true
if the value is a KdlValue::Null
.
sourcepub fn as_string(&self) -> Option<&str>
pub fn as_string(&self) -> Option<&str>
Returns Some(&str)
if the KdlValue
is a KdlValue::RawString
or a
KdlValue::String
, otherwise returns None
.
sourcepub fn as_i64(&self) -> Option<i64>
pub fn as_i64(&self) -> Option<i64>
Returns Some(i64)
if the KdlValue
is a KdlValue::Base2
,
KdlValue::Base8
, KdlValue::Base10
, or KdlValue::Base16
,
otherwise returns None
.
sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Returns Some(f64)
if the KdlValue
is a KdlValue::Base10Float
,
otherwise returns None
.
sourcepub fn as_bool(&self) -> Option<bool>
pub fn as_bool(&self) -> Option<bool>
Returns Some(bool)
if the KdlValue
is a KdlValue::Bool
, otherwise returns None
.