[−][src]Struct confindent::ConfSection
Methods
impl ConfSection
[src]
pub fn set_value<T: Into<String>>(&mut self, value: T) -> &mut Self
[src]
Set the value of this section
Example
use confindent::{Confindent, ConfParent}; let mut conf = Confindent::new(); conf.create("Section", "Placeholder"); let section = conf.child_mut("Section").unwrap(); section.set_value("Value"); assert_eq!(section.get::<String>().unwrap(), "Value");
pub fn set<T: Into<String>>(&mut self, value: T) -> &mut Self
[src]
Shorthand for set_value()
pub fn get_value<T: FromStr>(&self) -> Option<T>
[src]
Get the scalar value of this 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.child("Section").unwrap(); assert_eq!(section.get_value::<String>().unwrap(), "value");
pub fn get<T: FromStr>(&self) -> Option<T>
[src]
Shorthand for get_value()
pub fn get_vec<T: FromStr>(&self) -> Option<Vec<T>>
[src]
Get the value in this section as a vector
Example
use std::str::FromStr; use confindent::{Confindent, ConfParent}; let conf_str = "Section 1,2,3"; let conf = Confindent::from_str(conf_str).unwrap(); let section = conf.child("Section").unwrap(); assert_eq!(section.get_vec(), Some(vec![1, 2, 3]));
Trait Implementations
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]
Get a reference to the first child section with this name Read more
fn child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>
[src]
Shorthand for get_child()
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]
Get a mutable reference to the first child section with this name Read more
fn child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection>
[src]
Shorthand for get_child_mut()
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]
Shorthand for create_child()
fn get_child_value<T: Into<String>, Y: FromStr>(&self, key: T) -> Option<Y>
[src]
Get the value of the first child with this name Read more
fn child_value<T: Into<String>, Y: FromStr>(&self, key: T) -> Option<Y>
[src]
Shorthand for get_child_value()
impl PartialEq<ConfSection> for ConfSection
[src]
fn eq(&self, other: &ConfSection) -> bool
[src]
fn ne(&self, other: &ConfSection) -> bool
[src]
impl Debug for ConfSection
[src]
Auto Trait Implementations
impl Send for ConfSection
impl Sync for ConfSection
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,