pub struct CommentedValue {
pub value: Value,
pub comments: Comments,
pub style: Style,
}Expand description
A YAML value with optional comments and style for round-trip preservation
Fields§
§value: ValueThe actual YAML value
comments: CommentsComments associated with this value
style: StyleStyle information for formatting preservation
Implementations§
Source§impl CommentedValue
impl CommentedValue
Sourcepub fn with_leading_comments(value: Value, comments: Vec<String>) -> Self
pub fn with_leading_comments(value: Value, comments: Vec<String>) -> Self
Create a commented value with leading comments
Sourcepub fn with_trailing_comment(value: Value, comment: String) -> Self
pub fn with_trailing_comment(value: Value, comment: String) -> Self
Create a commented value with a trailing comment
Sourcepub fn add_leading_comment<S: Into<String>>(&mut self, comment: S)
pub fn add_leading_comment<S: Into<String>>(&mut self, comment: S)
Add a leading comment
Sourcepub fn set_trailing_comment<S: Into<String>>(&mut self, comment: S)
pub fn set_trailing_comment<S: Into<String>>(&mut self, comment: S)
Set a trailing comment
Sourcepub const fn has_comments(&self) -> bool
pub const fn has_comments(&self) -> bool
Check if this value has any comments
Sourcepub const fn with_quote_style(value: Value, quote_style: QuoteStyle) -> Self
pub const fn with_quote_style(value: Value, quote_style: QuoteStyle) -> Self
Create a commented value with quote style
Sourcepub const fn set_quote_style(&mut self, quote_style: QuoteStyle)
pub const fn set_quote_style(&mut self, quote_style: QuoteStyle)
Set the quote style
Sourcepub const fn quote_style(&self) -> Option<&QuoteStyle>
pub const fn quote_style(&self) -> Option<&QuoteStyle>
Get the quote style
Sourcepub const fn set_indent_style(&mut self, indent_style: IndentStyle)
pub const fn set_indent_style(&mut self, indent_style: IndentStyle)
Set the indentation style
Sourcepub const fn indent_style(&self) -> Option<&IndentStyle>
pub const fn indent_style(&self) -> Option<&IndentStyle>
Get the indentation style
Sourcepub const fn with_indent_style(value: Value, indent_style: IndentStyle) -> Self
pub const fn with_indent_style(value: Value, indent_style: IndentStyle) -> Self
Create a commented value with indentation style
Trait Implementations§
Source§impl Clone for CommentedValue
impl Clone for CommentedValue
Source§fn clone(&self) -> CommentedValue
fn clone(&self) -> CommentedValue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommentedValue
impl Debug for CommentedValue
Source§impl From<Value> for CommentedValue
impl From<Value> for CommentedValue
Source§impl PartialEq for CommentedValue
impl PartialEq for CommentedValue
impl Eq for CommentedValue
impl StructuralPartialEq for CommentedValue
Auto Trait Implementations§
impl Freeze for CommentedValue
impl RefUnwindSafe for CommentedValue
impl Send for CommentedValue
impl Sync for CommentedValue
impl Unpin for CommentedValue
impl UnwindSafe for CommentedValue
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
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
Compare self to
key and return true if they are equal.