pub(crate) struct Entry {
leading: Text,
key: String,
head: Text,
value: Value,
}Expand description
One key: value pair with the text before it.
Fields§
§leading: Text§key: String§head: Text§value: ValueImplementations§
Source§impl Entry
impl Entry
pub(super) const fn new( leading: Text, key: String, head: Text, value: Value, ) -> Self
Sourcepub(crate) fn empty_mapping() -> Self
pub(crate) fn empty_mapping() -> Self
An empty mapping that prints as {} until entries are inserted.
Sourcepub(crate) fn empty_with_decor(&self) -> Self
pub(crate) fn empty_with_decor(&self) -> Self
An empty mapping with this entry’s leading text and key.
Sourcepub(crate) fn named(self, key: &str) -> Self
pub(crate) fn named(self, key: &str) -> Self
This entry under another key, spelled as the canonical renderer spells keys.
Sourcefn replace_keeping_decor(&mut self, incoming: Self)
fn replace_keeping_decor(&mut self, incoming: Self)
Take the value of incoming, and its leading text when that holds
a comment. The key text and the comment on the key line stay.
pub(crate) fn key(&self) -> &str
pub(crate) const fn value(&self) -> &Value
pub(crate) const fn value_mut(&mut self) -> &mut Value
pub(super) fn into_value(self) -> Value
Sourcefn reindent_to(&mut self, indent: usize, step: usize)
fn reindent_to(&mut self, indent: usize, step: usize)
Move the key to indent and nested mappings step columns per
level. Text lines of the value, such as block scalar content, move
with the key.
Trait Implementations§
impl Eq for Entry
Source§impl Node for Entry
impl Node for Entry
Source§fn is_container(&self) -> bool
fn is_container(&self) -> bool
Whether this node holds keyed children.
fn child(&self, key: &str) -> Option<&Self>
fn child_mut(&mut self, key: &str) -> Option<&mut Self>
Source§fn adopt(&mut self, key: &str, source: &Self)
fn adopt(&mut self, key: &str, source: &Self)
Take the child
key from source, replacing the existing child or
appending. An existing child keeps its decor unless the desired child
brings a comment of its own, which replaces the leading comment.Source§fn adopt_shell(&mut self, key: &str, source: &Self)
fn adopt_shell(&mut self, key: &str, source: &Self)
Insert an empty container for the child
key of source, with the
decor and comment of that child.fn remove(&mut self, key: &str)
impl StructuralPartialEq for Entry
Auto Trait Implementations§
impl Freeze for Entry
impl RefUnwindSafe for Entry
impl Send for Entry
impl Sync for Entry
impl Unpin for Entry
impl UnsafeUnpin for Entry
impl UnwindSafe for Entry
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,
§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.