#[non_exhaustive]pub struct ElementComment {
pub array: Vec<PathSegment>,
pub index: usize,
pub after_spread: bool,
pub value: Option<String>,
pub text: String,
pub heading: bool,
}Expand description
The comment written next to one element of an array literal: on the lines directly above it, or after it on the line where it ends.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.array: Vec<PathSegment>The path to the array from the outermost literal that contains it.
index: usizeThe position of the element in the array literal; a spread counts as one element.
after_spread: boolWhether the element is a spread or comes after one. An evaluator that expands spreads puts such an element at
a position that index does not give, so pairing by position is only sound when this is false.
value: Option<String>The element when it is a string (its value) or a regular expression literal (its pattern).
text: StringThe comment text without its delimiters, its lines joined by single spaces. Comments both above and after the element are joined in source order.
heading: boolThe element has no comment of its own and text is its group heading: the comments above the nearest element
before it in the same array that has comments above it. A list written as groups, each under one comment
line, explains every element of a group with that line.
Implementations§
Source§impl ElementComment
impl ElementComment
Sourcepub fn new(
array: Vec<PathSegment>,
index: usize,
value: Option<String>,
text: impl Into<String>,
) -> Self
pub fn new( array: Vec<PathSegment>, index: usize, value: Option<String>, text: impl Into<String>, ) -> Self
The comment text on the element index of the array at array, whose value is value.
Sourcepub fn after_spread(self) -> Self
pub fn after_spread(self) -> Self
This comment, recording that its element is a spread or comes after one.
Sourcepub fn under_heading(self) -> Self
pub fn under_heading(self) -> Self
This comment, recording that it is the group heading of its element rather than a comment of its own.
Trait Implementations§
Source§impl Clone for ElementComment
impl Clone for ElementComment
Source§impl Debug for ElementComment
impl Debug for ElementComment
impl Eq for ElementComment
Source§impl PartialEq for ElementComment
impl PartialEq for ElementComment
impl StructuralPartialEq for ElementComment
Auto Trait Implementations§
impl Forget for ElementComment
impl Freeze for ElementComment
impl Move for ElementComment
impl RefUnwindSafe for ElementComment
impl Send for ElementComment
impl Sync for ElementComment
impl Unpin for ElementComment
impl UnsafeUnpin for ElementComment
impl UnwindSafe for ElementComment
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
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,
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.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more