[−][src]Trait confindent::ConfParent
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");
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()