pub enum Value<'a> {
Rational(Decimal),
Float(f64),
Integer(usize),
String(Cow<'a, str>),
}Expand description
All the possible variations of a field’s value. Some flavors of g-code also allow for strings.
Any strings here are expected to have escaped characters, see https://www.reprap.org/wiki/G-code#Quoted_strings
Variants§
Implementations§
source§impl Value<'_>
impl Value<'_>
sourcepub fn as_f64(&self) -> Option<f64>
pub fn as_f64(&self) -> Option<f64>
Interpret the value as an f64
Returns Option::None for Value::String or a Value::Rational that can’t be converted.
sourcepub fn into_owned(self) -> Value<'static>
pub fn into_owned(self) -> Value<'static>
Returns an owned representation of the Value valid for the 'static lifetime.
This will allocate a string for a Value::String.
Trait Implementations§
source§impl<'input> From<&Value<'input>> for Value<'input>
impl<'input> From<&Value<'input>> for Value<'input>
source§fn from(val: &ParsedValue<'input>) -> Self
fn from(val: &ParsedValue<'input>) -> Self
Converts to this type from the input type.