pub struct Trivia {
pub kind: TriviaKind,
pub text: String,
pub span: Span,
}Expand description
A single trivia element — a comment or whitespace gap.
Fields§
§kind: TriviaKindThe kind of trivia.
text: StringThe exact source text of this trivia (including delimiters).
span: SpanThe span of this trivia in the source.
Implementations§
Source§impl Trivia
impl Trivia
Sourcepub fn line_comment(text: &str, span: Span) -> Self
pub fn line_comment(text: &str, span: Span) -> Self
Create a line comment trivia.
Sourcepub fn block_comment(text: &str, span: Span) -> Self
pub fn block_comment(text: &str, span: Span) -> Self
Create a block comment trivia.
Sourcepub fn whitespace(text: &str, span: Span) -> Self
pub fn whitespace(text: &str, span: Span) -> Self
Create a whitespace trivia.
Sourcepub fn is_comment(&self) -> bool
pub fn is_comment(&self) -> bool
Is this trivia a comment?
Sourcepub fn is_whitespace(&self) -> bool
pub fn is_whitespace(&self) -> bool
Is this trivia whitespace?
Trait Implementations§
impl Eq for Trivia
impl StructuralPartialEq for Trivia
Auto Trait Implementations§
impl Freeze for Trivia
impl RefUnwindSafe for Trivia
impl Send for Trivia
impl Sync for Trivia
impl Unpin for Trivia
impl UnsafeUnpin for Trivia
impl UnwindSafe for Trivia
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.