[][src]Trait confindent::ConfParent

pub trait ConfParent {
    fn get_child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>;
fn get_child_mut<T: Into<String>>(
        &mut self,
        key: T
    ) -> Option<&mut ConfSection>;
fn create_child<T: Into<String>>(&mut self, key: T, value: T) -> &mut Self; fn child<T: Into<String>>(&self, key: T) -> Option<&ConfSection> { ... }
fn child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection> { ... }
fn create<T: Into<String>>(&mut self, key: T, value: T) -> &mut Self { ... }
fn get_child_value<T: Into<String>, Y: FromStr>(&self, key: T) -> Option<Y> { ... }
fn child_value<T: Into<String>, Y: FromStr>(&self, key: T) -> Option<Y> { ... } }

Methods for configuration sections with children

Required methods

fn get_child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>

Get a reference to a child section

Example

use std::str::FromStr;
use confindent::{Confindent, ConfParent};

let conf_str = "Section value";
let conf = Confindent::from_str(conf_str).unwrap();
let section = conf.get_child("Section").unwrap();

fn get_child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection>

Get a mutable reference to a child section

Example

use std::str::FromStr;
use confindent::{Confindent, ConfParent};

let conf_str = "Section value";
let mut conf = Confindent::from_str(conf_str).unwrap();
let mut section = conf.get_child_mut("Section").unwrap();

fn create_child<T: Into<String>>(&mut self, key: T, value: T) -> &mut Self

Create a child section

Example

use confindent::{Confindent, ConfParent};

let mut conf = Confindent::new();
conf.create_child("Key", "Value");
Loading content...

Provided methods

fn child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>

Shorthand for get_child()

fn child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection>

Shorthand for get_child_mut()

fn create<T: Into<String>>(&mut self, key: T, value: T) -> &mut Self

Shorthand for create_child()

fn get_child_value<T: Into<String>, Y: FromStr>(&self, key: T) -> Option<Y>

Get the value of a child

Example

use std::str::FromStr;
use confindent::{Confindent, ConfParent};

let conf_str = "Section key";
let conf = Confindent::from_str(conf_str).unwrap();

let value: Option<String> = conf.get_child_value("Section");
assert_eq!(value.unwrap(), "key");

fn child_value<T: Into<String>, Y: FromStr>(&self, key: T) -> Option<Y>

Shorthand for get_child_value()

Loading content...

Implementors

impl ConfParent for ConfSection[src]

fn child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>[src]

fn child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection>[src]

fn create<T: Into<String>>(&mut self, key: T, value: T) -> &mut Self[src]

fn get_child_value<T: Into<String>, Y: FromStr>(&self, key: T) -> Option<Y>[src]

fn child_value<T: Into<String>, Y: FromStr>(&self, key: T) -> Option<Y>[src]

impl ConfParent for Confindent[src]

fn child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>[src]

fn child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection>[src]

fn create<T: Into<String>>(&mut self, key: T, value: T) -> &mut Self[src]

fn get_child_value<T: Into<String>, Y: FromStr>(&self, key: T) -> Option<Y>[src]

fn child_value<T: Into<String>, Y: FromStr>(&self, key: T) -> Option<Y>[src]

Loading content...