[−][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_child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>
[src]
fn get_child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection>
[src]
fn create_child<T: Into<String>>(&mut self, key: T, value: T) -> &mut Self
[src]
fn child<T: Into<String>>(&self, key: T) -> Option<&ConfSection>
[src]
Shorthand for get_child()
fn child_mut<T: Into<String>>(&mut self, key: T) -> Option<&mut ConfSection>
[src]
Shorthand for get_child_mut()
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 a child 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> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,