Struct light_ini::IniParser

source ·
pub struct IniParser<'a, Error: Debug + Error> { /* private fields */ }
Expand description

INI format parser.

Implementations§

source§

impl<'a, Error: Debug + Error> IniParser<'a, Error>

source

pub fn new( handler: &'a mut dyn IniHandler<Error = Error> ) -> IniParser<'a, Error>

Create a parser using the given handler.

Examples found in repository?
examples/hashmap.rs (line 68)
65
66
67
68
69
70
71
72
73
74
75
fn main() {
    for filename in env::args().skip(1) {
        let mut handler = Handler::new();
        let mut parser = IniParser::new(&mut handler);
        let path = PathBuf::from(&filename);
        parser.parse_file(path).unwrap();
        println!("File {}", filename);
        println!("Globals {:#?}", handler.globals);
        println!("Sections {:#?}", handler.sections);
    }
}
source

pub fn with_start_comment( handler: &'a mut dyn IniHandler<Error = Error>, start_comment: char ) -> IniParser<'a, Error>

Create a parser using the given character as start of comment.

source

pub fn parse_buffered<B: BufRead>( &mut self, input: B ) -> Result<(), IniError<Error>>

Parse input from a buffered reader.

source

pub fn parse<R: Read>(&mut self, input: R) -> Result<(), IniError<Error>>

Parse input from a reader.

source

pub fn parse_file<P>(&mut self, path: P) -> Result<(), IniError<Error>>where P: AsRef<Path>,

Parse a file.

Examples found in repository?
examples/hashmap.rs (line 70)
65
66
67
68
69
70
71
72
73
74
75
fn main() {
    for filename in env::args().skip(1) {
        let mut handler = Handler::new();
        let mut parser = IniParser::new(&mut handler);
        let path = PathBuf::from(&filename);
        parser.parse_file(path).unwrap();
        println!("File {}", filename);
        println!("Globals {:#?}", handler.globals);
        println!("Sections {:#?}", handler.sections);
    }
}

Auto Trait Implementations§

§

impl<'a, Error> !RefUnwindSafe for IniParser<'a, Error>

§

impl<'a, Error> !Send for IniParser<'a, Error>

§

impl<'a, Error> !Sync for IniParser<'a, Error>

§

impl<'a, Error> Unpin for IniParser<'a, Error>

§

impl<'a, Error> !UnwindSafe for IniParser<'a, Error>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.