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.
impl<'a> StructuralPartialEq for Value<'a>
Auto Trait Implementations§
impl<'a> Freeze for Value<'a>
impl<'a> RefUnwindSafe for Value<'a>
impl<'a> Send for Value<'a>
impl<'a> Sync for Value<'a>
impl<'a> Unpin for Value<'a>
impl<'a> UnwindSafe for Value<'a>
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