Skip to main content

Entry

Struct Entry 

Source
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: Value

Implementations§

Source§

impl Entry

Source

pub(super) const fn new( leading: Text, key: String, head: Text, value: Value, ) -> Self

Source

pub(super) fn root(value: Value) -> Self

The root of a document, which has no key.

Source

pub(crate) fn empty_mapping() -> Self

An empty mapping that prints as {} until entries are inserted.

Source

pub(crate) fn empty_with_decor(&self) -> Self

An empty mapping with this entry’s leading text and key.

Source

pub(crate) fn named(self, key: &str) -> Self

This entry under another key, spelled as the canonical renderer spells keys.

Source

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.

Source

pub(crate) fn key(&self) -> &str

Source

pub(crate) const fn value(&self) -> &Value

Source

pub(crate) const fn value_mut(&mut self) -> &mut Value

Source

pub(super) fn into_value(self) -> Value

Source

pub(super) fn indent(&self) -> usize

The column of the key.

Source

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§

Source§

impl Clone for Entry

Source§

fn clone(&self) -> Entry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Entry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Entry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Entry

Source§

impl Node for Entry

Source§

fn is_container(&self) -> bool

Whether this node holds keyed children.
Source§

fn keys(&self) -> impl Iterator<Item = &str> + '_

The child keys in order. Empty for leaves.
Source§

fn child(&self, key: &str) -> Option<&Self>

Source§

fn child_mut(&mut self, key: &str) -> Option<&mut Self>

Source§

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)

Insert an empty container for the child key of source, with the decor and comment of that child.
Source§

fn remove(&mut self, key: &str)

Source§

fn is_empty(&self) -> bool

Whether this node has no children.
Source§

impl PartialEq for Entry

Source§

fn eq(&self, other: &Entry) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.