pub struct Trivia {
pub kind: TriviaKind,
pub span: Span,
}Fields§
§kind: TriviaKind§span: SpanImplementations§
Source§impl Trivia
impl Trivia
Sourcepub const fn comment_text(&self) -> Option<&str>
pub const fn comment_text(&self) -> Option<&str>
Project the wrapped TriviaKind::LineComment body as &str, or
None on the sibling two arms (TriviaKind::BlankLine +
TriviaKind::Shebang) — the trivia-envelope-scoped surface every
downstream authoring consumer that only needs the line-comment body
(a caixa-fmt block-comment paragraph-fill pass over the collected
trivia list, a caixa-lint doc-comment / rustdoc-shape probe, a
deferred caixa-lsp hover pop-up that renders the comment body on
mouse-over) partitions on.
pub const fn — closes const-eval discipline on the Trivia
envelope-scoped projection axis, peer with the sibling
crate::TriviaKind IsVariant-derived per-arm predicate
discriminators (TriviaKind::is_line_comment +
TriviaKind::is_blank_line + TriviaKind::is_shebang) on the
same trivia-arm-discriminator surface. The body reaches for
String::as_str on the TriviaKind::LineComment borrowed-
String slot — const-stable since Rust 1.87, well before this
workspace’s 1.89 MSRV floor — so the promotion is a body-preserving
type-signature widening. Matches the sibling per-source-position-
primitive const-eval-surface family on the caixa-ast surface
(crate::Span::new / crate::Span::point / crate::Span::len
/ crate::Span::is_empty / crate::Span::contains /
crate::Span::union on the byte-offset axis,
crate::Position::new / crate::Position::origin on the 1-
indexed line/column axis, [crate::Position::line_column] on the
Position projection axis, crate::NodeKind::seq_delims /
crate::NodeKind::reader_macro_prefix / crate::NodeKind::as_keyword
/ crate::NodeKind::as_symbol / crate::NodeKind::as_str on
the outer-NodeKind writer-half projection axis) — every downstream
consumer that wants a compile-time line-comment-body fixture (a
const HEADER: Option<&str> = TRIVIA.comment_text(); compile-time
oracle a caixa-fmt paragraph-fill pass keys off, a per-lint const-
context doc-comment shape probe a future admission webhook
consults) now reads through one substrate-primitive const dispatch
rather than being forced onto the runtime code path.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.