[][src]Enum liberty_parse::ast::Value

pub enum Value {
    Bool(bool),
    Float(f64),
    FloatGroup(Vec<f64>),
    String(String),
    Expression(String),
}

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.

Methods

impl Value[src]

pub fn to_string(&self) -> String[src]

Get a String representation of a Value

pub fn float(&self) -> f64[src]

Convert Value::Float to f64 or panic

pub fn string(&self) -> String[src]

Convert Value::String to String or panic

pub fn expr(&self) -> String[src]

Convert Value::Expression to String or panic

pub fn bool(&self) -> bool[src]

Convert Value::Bool to bool or panic

pub fn float_group(&self) -> Vec<f64>[src]

Convert Value::FloatGroup to Vec<f64> or panic

Trait Implementations

impl Clone for Value[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<Value> for Value[src]

impl Debug for Value[src]

Auto Trait Implementations

impl Sync for Value

impl Send for Value

impl Unpin for Value

impl RefUnwindSafe for Value

impl UnwindSafe for Value

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]