pub struct MappingBuilder { /* private fields */ }Expand description
Builder for YAML mappings.
Implementations§
Source§impl MappingBuilder
impl MappingBuilder
Sourcepub fn pair(self, key: impl Into<String>, value: impl AsYaml) -> Self
pub fn pair(self, key: impl Into<String>, value: impl AsYaml) -> Self
Add a key-value pair. The value can be any type implementing AsYaml:
&str, String, i64, bool, f64, CST nodes, etc.
Sourcepub fn sequence<F>(self, key: impl Into<String>, f: F) -> Self
pub fn sequence<F>(self, key: impl Into<String>, f: F) -> Self
Add a key-value pair with a sequence value.
Sourcepub fn mapping<F>(self, key: impl Into<String>, f: F) -> Self
pub fn mapping<F>(self, key: impl Into<String>, f: F) -> Self
Add a key-value pair with a mapping value.
Sourcepub fn insert_sequence(
self,
key: impl Into<String>,
other: SequenceBuilder,
) -> Self
pub fn insert_sequence( self, key: impl Into<String>, other: SequenceBuilder, ) -> Self
Insert a key-value pair with a pre-built SequenceBuilder.
Sourcepub fn insert_mapping(
self,
key: impl Into<String>,
other: MappingBuilder,
) -> Self
pub fn insert_mapping( self, key: impl Into<String>, other: MappingBuilder, ) -> Self
Insert a key-value pair with a pre-built MappingBuilder.
Sourcepub fn build(self) -> YamlBuilder
pub fn build(self) -> YamlBuilder
Build the mapping into a YamlBuilder.
Sourcepub fn build_document(self) -> Document
pub fn build_document(self) -> Document
Build the mapping directly into a Document.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MappingBuilder
impl RefUnwindSafe for MappingBuilder
impl Send for MappingBuilder
impl Sync for MappingBuilder
impl Unpin for MappingBuilder
impl UnsafeUnpin for MappingBuilder
impl !UnwindSafe for MappingBuilder
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