pub enum Event<'a> {
LineComment(&'a str, &'a str),
BlockComment(&'a str, &'a str),
}
Expand description
Text is the contents of the comment, while raw includes additional characters based on the type of comment, such as the comment delimiters or “start and end symbols” of the comment.
LineComment
’sraw
includes the whole line.BlockComment
’sraw
includes only the block comment delimiters.
The above is only true, for events parsed by CommentParser
.
§Example
let line = Event::LineComment(" // Foo Bar", " Foo Bar");
assert_eq!(line.text(), " Foo Bar");
assert_eq!(line.raw(), " // Foo Bar");
let block = Event::BlockComment("/* Foo\n Bar */", " Foo\n Bar ");
assert_eq!(block.text(), " Foo\n Bar ");
assert_eq!(block.raw(), "/* Foo\n Bar */");
Variants§
LineComment(&'a str, &'a str)
LineComment(raw, text)
BlockComment(&'a str, &'a str)
BlockComment(raw, text)
Implementations§
Trait Implementations§
impl<'a> StructuralPartialEq for Event<'a>
Auto Trait Implementations§
impl<'a> Freeze for Event<'a>
impl<'a> RefUnwindSafe for Event<'a>
impl<'a> Send for Event<'a>
impl<'a> Sync for Event<'a>
impl<'a> Unpin for Event<'a>
impl<'a> UnwindSafe for Event<'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