pub struct Comment { /* private fields */ }Expand description
A comment rule.
Comments do not generate tokens, unlike most rules. Instead, they are
attached to the span of a token, and can be inspected through
Span::comments().
Implementations§
Source§impl Comment
impl Comment
Sourcepub fn line(delim: impl Into<Yarn>) -> Self
pub fn line(delim: impl Into<Yarn>) -> Self
Creates a new line comment. Line comments cannot nest, and run from
starting delimiter (which is something like // or #) to the next
'\n' character (not including it).
Sourcepub fn block(open: impl Into<Yarn>, close: impl Into<Yarn>) -> Self
pub fn block(open: impl Into<Yarn>, close: impl Into<Yarn>) -> Self
Creates a new nestable block comment with paired delimiters.
Sourcepub fn nesting(bracket: Bracket) -> Self
pub fn nesting(bracket: Bracket) -> Self
Creates a new comment that can nest. For example, Rust block comments
can nest: /* /* */ */
Sourcepub fn non_nesting(bracket: Bracket) -> Self
pub fn non_nesting(bracket: Bracket) -> Self
Creates a new comment that can’t nest. For example, a line comment is a non-nesting comment where a newline ‘\n’ is the closing delimiter.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Comment
impl RefUnwindSafe for Comment
impl Send for Comment
impl Sync for Comment
impl Unpin for Comment
impl UnwindSafe for Comment
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