[−][src]Trait confindent::ConfParent
Methods for configuration sections with children
Required methods
fn get_children<T: Into<String>>(&self, key: T) -> Option<Vec<&ConfSection>>
Get a Vec of children with this name
Example
use std::str::FromStr; use confindent::{Confindent, ConfParent}; let conf_str = "Section value0\nSection value1"; let conf = Confindent::from_str(conf_str).unwrap(); let sections = conf.get_children("Section").unwrap();
fn get_children_mut<T: Into<String>>(
&mut self,
key: T
) -> Option<Vec<&mut ConfSection>>
&mut self,
key: T
) -> Option<Vec<&mut ConfSection>>
Get a Vec of mutable children with this name
Example
use std::str::FromStr; use confindent::{Confindent, ConfParent}; let conf_str = "Section value0\nSection value1"; let mut conf = Confindent::from_str(conf_str).unwrap(); let mut sections = conf.get_children_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 get_child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>
Get a reference to the first child section with this name
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 child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>
Shorthand for get_child()
fn children<T: Into<String>>(&self, key: T) -> Option<Vec<&ConfSection>>
fn get_child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection>
Get a mutable reference to the first child section with this name
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 child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection>
Shorthand for get_child_mut()
fn children_mut<T: Into<String>>(
&mut self,
key: T
) -> Option<Vec<&mut ConfSection>>
&mut self,
key: T
) -> Option<Vec<&mut ConfSection>>
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 the first child with this name
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()
Implementors
impl ConfParent for ConfSection
[src]
fn get_children<T: Into<String>>(&self, key: T) -> Option<Vec<&ConfSection>>
[src]
fn get_children_mut<T: Into<String>>(
&mut self,
key: T
) -> Option<Vec<&mut ConfSection>>
[src]
&mut self,
key: T
) -> Option<Vec<&mut ConfSection>>
fn create_child<T: Into<String>>(&mut self, key: T, value: T) -> &mut Self
[src]
fn get_child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>
[src]
fn child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>
[src]
fn children<T: Into<String>>(&self, key: T) -> Option<Vec<&ConfSection>>
[src]
fn get_child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection>
[src]
fn child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection>
[src]
fn children_mut<T: Into<String>>(
&mut self,
key: T
) -> Option<Vec<&mut ConfSection>>
[src]
&mut self,
key: T
) -> Option<Vec<&mut ConfSection>>
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 get_children<T: Into<String>>(&self, key: T) -> Option<Vec<&ConfSection>>
[src]
fn get_children_mut<T: Into<String>>(
&mut self,
key: T
) -> Option<Vec<&mut ConfSection>>
[src]
&mut self,
key: T
) -> Option<Vec<&mut ConfSection>>
fn create_child<T: Into<String>>(&mut self, key: T, value: T) -> &mut Self
[src]
fn get_child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>
[src]
fn child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>
[src]
fn children<T: Into<String>>(&self, key: T) -> Option<Vec<&ConfSection>>
[src]
fn get_child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection>
[src]
fn child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection>
[src]
fn children_mut<T: Into<String>>(
&mut self,
key: T
) -> Option<Vec<&mut ConfSection>>
[src]
&mut self,
key: T
) -> Option<Vec<&mut ConfSection>>