Struct slr_config::ConfigElement[][src]

pub struct ConfigElement { /* fields omitted */ }

A configuration element.

Implementations

impl ConfigElement[src]

pub fn new_table() -> ConfigElement[src]

Creates a new empty table.

pub fn new_tagged_table(tag: String) -> ConfigElement[src]

Creates a new empty tagged table.

pub fn new_value<T: ToString>(value: T) -> ConfigElement[src]

Creates a new value.

pub fn new_array() -> ConfigElement[src]

Creates a new array.

pub fn new_tagged_array(tag: String) -> ConfigElement[src]

Creates a new tagged array.

pub fn from_source<'l>(source: &mut Source<'l>) -> Result<ConfigElement, Error>[src]

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.

pub fn from_str(src: &str) -> Result<ConfigElement, Error>[src]

Parses a source and returns a table.

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

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.

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

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

pub fn kind(&self) -> &ConfigElementKind[src]

Returns the kind of this element.

pub fn kind_mut(&mut self) -> &mut ConfigElementKind[src]

Returns the kind of this element.

pub fn span(&self) -> Span[src]

Returns the span associated with this element.

pub fn as_table(&self) -> Option<&BTreeMap<String, ConfigElement>>[src]

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

pub fn into_table(self) -> Option<BTreeMap<String, ConfigElement>>[src]

If this is a table, returns its contents.

pub fn as_table_mut(&mut self) -> Option<&mut BTreeMap<String, ConfigElement>>[src]

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

pub fn as_value(&self) -> Option<&String>[src]

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

pub fn into_value(self) -> Option<String>[src]

If this is a value, returns its contents.

pub fn as_value_mut(&mut self) -> Option<&mut String>[src]

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

pub fn as_array(&self) -> Option<&Vec<ConfigElement>>[src]

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

pub fn into_array(self) -> Option<Vec<ConfigElement>>[src]

If this is an array, returns its contents.

pub fn as_array_mut(&mut self) -> Option<&mut Vec<ConfigElement>>[src]

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

pub fn tag(&self) -> Option<&String>[src]

pub fn tag_mut(&mut self) -> Option<&mut String>[src]

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

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

pub fn print<W: Write>(
    &self,
    name: Option<&str>,
    is_root: bool,
    printer: &mut Printer<'_, W>
) -> Result<(), Error>
[src]

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

Trait Implementations

impl Clone for ConfigElement[src]

impl Debug for ConfigElement[src]

impl Display for ConfigElement[src]

Auto Trait Implementations

impl RefUnwindSafe for ConfigElement

impl Send for ConfigElement

impl Sync for ConfigElement

impl Unpin for ConfigElement

impl UnwindSafe for ConfigElement

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.