pub struct Comment { /* private fields */ }Expand description
Comment text attached to a LocatedValue: lines preceding the key and an optional
inline comment on the same line as the value.
Empty by default — callers check .before().is_empty() and .after() to detect absence.
Implementations§
Source§impl Comment
impl Comment
pub fn new() -> Self
pub fn before_mut(&mut self) -> &mut Vec<String>
Sourcepub fn after(&self) -> Option<&str>
pub fn after(&self) -> Option<&str>
Inline comment on the same line as the value; None when absent.
pub fn after_mut(&mut self) -> &mut Option<String>
Sourcepub fn with_before(
self,
lines: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_before( self, lines: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Builder: set the before-lines (replaces any existing).
Sourcepub fn with_after(self, text: Option<impl Into<String>>) -> Self
pub fn with_after(self, text: Option<impl Into<String>>) -> Self
Builder: set the inline after-comment.
Sourcepub fn set_before(&mut self, lines: impl IntoIterator<Item = impl Into<String>>)
pub fn set_before(&mut self, lines: impl IntoIterator<Item = impl Into<String>>)
In-place setter for before-lines.
Trait Implementations§
impl StructuralPartialEq for Comment
Auto Trait Implementations§
impl Freeze for Comment
impl RefUnwindSafe for Comment
impl Send for Comment
impl Sync for Comment
impl Unpin for Comment
impl UnsafeUnpin 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