pub enum Item<'a> {
Error(&'a str),
Section(&'a str),
SectionEnd,
Property(&'a str, Option<&'a str>),
Comment(&'a str),
Blank,
}
Expand description
Ini element.
§Notes
Strings are not checked or escaped when displaying the item.
Ensure that they do not contain newlines or invalid characters.
Variants§
Error(&'a str)
Syntax error.
Section header element was malformed.
Malformed section headers are defined by a line starting with [
but not ending with ]
.
assert_eq!(
ini_core::Parser::new("[Error").nth(1),
Some(ini_core::Item::Error("[Error")));
Section(&'a str)
Section header element.
assert_eq!(
ini_core::Parser::new("[Section]").nth(1),
Some(ini_core::Item::Section("Section")));
SectionEnd
End of section.
Pseudo element emitted before a Section
and at the end of the document.
This helps processing sections after their properties finished parsing.
assert_eq!(
ini_core::Parser::new("").next(),
Some(ini_core::Item::SectionEnd));
Property(&'a str, Option<&'a str>)
Property element.
Key value must not contain =
.
The value is None
if there is no =
.
assert_eq!(
ini_core::Parser::new("Key=Value").next(),
Some(ini_core::Item::Property("Key", Some("Value"))));
assert_eq!(
ini_core::Parser::new("Key").next(),
Some(ini_core::Item::Property("Key", None)));
Comment(&'a str)
Comment.
assert_eq!(
ini_core::Parser::new(";comment").next(),
Some(ini_core::Item::Comment("comment")));
Blank
Blank line.
Allows faithful reproduction of the whole ini document including blank lines.
assert_eq!(
ini_core::Parser::new("\n").next(),
Some(ini_core::Item::Blank));
Trait Implementations§
impl<'a> Copy for Item<'a>
impl<'a> Eq for Item<'a>
impl<'a> StructuralPartialEq for Item<'a>
Auto Trait Implementations§
impl<'a> Freeze for Item<'a>
impl<'a> RefUnwindSafe for Item<'a>
impl<'a> Send for Item<'a>
impl<'a> Sync for Item<'a>
impl<'a> Unpin for Item<'a>
impl<'a> UnwindSafe for Item<'a>
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