pub struct IniParser<'a, Error: Debug + Error> { /* private fields */ }Expand description
INI format parser.
Implementations§
Source§impl<'a, Error: Debug + Error> IniParser<'a, Error>
impl<'a, Error: Debug + Error> IniParser<'a, Error>
Sourcepub fn new(
handler: &'a mut dyn IniHandler<Error = Error>,
) -> IniParser<'a, Error>
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 82)
79fn main() -> Result<(), MainError> {
80 for filename in env::args().skip(1) {
81 let mut handler = Handler::new();
82 let mut parser = IniParser::new(&mut handler);
83 let path = PathBuf::from(&filename);
84 parser.parse_file(path)?;
85 println!("File {}", filename);
86 println!("Globals {:#?}", handler.globals);
87 println!("Sections {:#?}", handler.sections);
88 }
89 Ok(())
90}Sourcepub fn with_start_comment(
handler: &'a mut dyn IniHandler<Error = Error>,
start_comment: char,
) -> IniParser<'a, Error>
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.
Sourcepub fn parse_buffered<B: BufRead>(
&mut self,
input: B,
) -> Result<(), IniError<Error>>
pub fn parse_buffered<B: BufRead>( &mut self, input: B, ) -> Result<(), IniError<Error>>
Parse input from a buffered reader.
Sourcepub fn parse<R: Read>(&mut self, input: R) -> Result<(), IniError<Error>>
pub fn parse<R: Read>(&mut self, input: R) -> Result<(), IniError<Error>>
Parse input from a reader.
Sourcepub fn parse_file<P>(&mut self, path: P) -> Result<(), IniError<Error>>
pub fn parse_file<P>(&mut self, path: P) -> Result<(), IniError<Error>>
Parse a file.
Examples found in repository?
examples/hashmap.rs (line 84)
79fn main() -> Result<(), MainError> {
80 for filename in env::args().skip(1) {
81 let mut handler = Handler::new();
82 let mut parser = IniParser::new(&mut handler);
83 let path = PathBuf::from(&filename);
84 parser.parse_file(path)?;
85 println!("File {}", filename);
86 println!("Globals {:#?}", handler.globals);
87 println!("Sections {:#?}", handler.sections);
88 }
89 Ok(())
90}Auto Trait Implementations§
impl<'a, Error> Freeze for IniParser<'a, Error>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more