Enum acon::Acon [] [src]

pub enum Acon {
    Array(Array),
    String(String),
    Table(Table),
}

Enumeration over all variable types in ACON

Variants

Array type contains a Vec of Acon

String type contains a simple std::string::String

Table consists of a BTreeMap

Methods

impl Acon
[src]

Assert that this value is an array, else panic

Assert that this value is a string, else panic

Assert that this value is a table, else panic

Retrieve a reference to an entry via its path Paths are dot-separated.

use acon::Acon;
 let input = r#"
 { table
   [ array
     value
 $
 "#;
 let result = input.parse::<Acon>().unwrap();
 assert_eq!(result.path("table.array.0").unwrap().string(), "value");

Retrieve a mutable reference to an entry via its path. Paths are dot-separated.

Retrieve a reference to an entry

Retrieve a mutable reference to an entry

Trait Implementations

impl PartialEq for Acon
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Clone for Acon
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Acon
[src]

Formats the value using the given formatter.

impl Display for Acon
[src]

Formats the value using the given formatter. Read more

impl FromStr for Acon
[src]

The associated error which can be returned from parsing.

Parse a string into an Acon value

use acon::Acon;
 let input = r#"
   key value
   { table-name
     key value
     key2 value2
   }
 "#;
 let result = input.parse::<Acon>().unwrap();
 match result {
   Acon::Table(_) => assert!(true),
   _ => assert!(false),
 }