Enum acon::Acon
[−]
[src]
pub enum Acon { Array(Array), String(String), Table(Table), }
Enumeration over all variable types in ACON
Variants
Array(Array)
Array type contains a Vec of Acon
String(String)
String type contains a simple std::string::String
Table(Table)
Table consists of a BTreeMap
Methods
impl Acon
[src]
fn array(&self) -> &Array
Assert that this value is an array, else panic
fn string(&self) -> &String
Assert that this value is a string, else panic
fn table(&self) -> &Table
Assert that this value is a table, else panic
fn path(&self, path: &str) -> Option<&Acon>
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");
fn path_mut(&mut self, path: &str) -> Option<&mut Acon>
Retrieve a mutable reference to an entry via its path. Paths are dot-separated.
fn get(&self, path: &str) -> Option<&Acon>
Retrieve a reference to an entry
fn get_mut(&mut self, path: &str) -> Option<&mut Acon>
Retrieve a mutable reference to an entry
Trait Implementations
impl PartialEq for Acon
[src]
fn eq(&self, __arg_0: &Acon) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Acon) -> bool
This method tests for !=
.
impl Clone for Acon
[src]
fn clone(&self) -> Acon
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Acon
[src]
impl Display for Acon
[src]
impl FromStr for Acon
[src]
type Err = AconError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
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), }