pub enum Value {
Bool(bool),
Float(f64),
FloatGroup(Vec<f64>),
String(String),
Expression(String),
}Expand description
Liberty value type
A wide range of types are defined for the Liberty syntax. Because there is little to no way
to parse enumerated types from the syntax alone, enumerated types are parsed as the
Value::Expression variant.
Variants§
Bool(bool)
Boolean value, parsed from the keywords true and false
Float(f64)
Floating point value.
All numbers are parsed into f64. While the Liberty specification differentiates between
integers and floating point values on a per-field basis, all are parsed into an f64.
FloatGroup(Vec<f64>)
Group of floating point values in quotation marks
For example, this complex attribute
values ( \
"1.0, 2.0, 3.0", \
"4.0, 5.0, 6.0" \
);will be parsed into a Vec<Value::FloatGroup>.
String(String)
String enclosed in quotation marks
Expression(String)
Expression
Enumerated values, such as the delay_model simple attribute, are parsed as a
Value::Expression.
Implementations§
Source§impl Value
impl Value
Sourcepub fn float(&self) -> f64
pub fn float(&self) -> f64
Convert Value::Float to f64 or panic
Sourcepub fn string(&self) -> String
pub fn string(&self) -> String
Convert Value::String to String or panic
Sourcepub fn expr(&self) -> String
pub fn expr(&self) -> String
Convert Value::Expression to String or panic
Sourcepub fn bool(&self) -> bool
pub fn bool(&self) -> bool
Convert Value::Bool to bool or panic
Sourcepub fn float_group(&self) -> Vec<f64>
pub fn float_group(&self) -> Vec<f64>
Convert Value::FloatGroup to Vec<f64> or panic
Trait Implementations§
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more