Struct slr_config::ConfigElement [] [src]

pub struct ConfigElement {
    // some fields omitted
}

A configuration element.

Methods

impl ConfigElement
[src]

fn new_table() -> ConfigElement

Creates a new empty table.

fn new_value<T: ToString>(value: T) -> ConfigElement

Creates a new value.

fn new_array() -> ConfigElement

Creates a new array.

fn from_source<'l, 'm>(source: &'m mut Source<'l>) -> Result<ConfigElementError>

Parses a source and returns a table. The source will be reset by this operation, and must not be used with any spans created from a previous parsing done with that source.

fn from_str(src: &str) -> Result<ConfigElementError>

Parses a source and returns a table.

fn from_source_with_init<'l, 'm>(&mut self, source: &'m mut Source<'l>) -> Result<()Error>

Updates the elements in this table with new values parsed from source. If an error occurs, the contents of this table are undefined. The source will be reset by this operation, and must not be used with any spans created from a previous lexing done with that source.

fn from_str_with_init(&mut self, src: &str) -> Result<()Error>

Updates the elements in this table with new values parsed from source. If an error occurs, the contents of this table are undefined.

fn kind(&self) -> &ConfigElementKind

Returns the kind of this element.

fn kind_mut(&mut self) -> &mut ConfigElementKind

Returns the kind of this element.

fn span(&self) -> Span

Returns the span associated with this element.

fn as_table(&self) -> Option<&BTreeMap<StringConfigElement>>

If this is a table, returns a pointer to its contents.

fn as_table_mut(&mut self) -> Option<&mut BTreeMap<StringConfigElement>>

If this is a table, returns a pointer to its contents.

fn as_value(&self) -> Option<&String>

If this is a value, returns a pointer to its contents.

fn as_value_mut(&mut self) -> Option<&mut String>

If this is a value, returns a pointer to its contents.

fn as_array(&self) -> Option<&Vec<ConfigElement>>

If this is an array, returns a pointer to its contents.

fn as_array_mut(&mut self) -> Option<&mut Vec<ConfigElement>>

If this is an array, returns a pointer to its contents.

fn insert<T: ToString>(&mut self, name: T, elem: ConfigElement)

Insert an element into a table or an array. Panics if self is a value. name is ignored if self is an array.

fn print<W: Write>(&self, name: Option<&str>, is_root: bool, printer: &mut Printer<W>) -> Result<()Error>

Outputs the string representation of this element into into a printer.

Trait Implementations

impl Clone for ConfigElement
[src]

fn clone(&self) -> ConfigElement

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 Display for ConfigElement
[src]

fn fmt(&self, formatter: &mut Formatter) -> Result<()Error>

Formats the value using the given formatter.