Yaml

Struct Yaml 

Source
pub struct Yaml {
    config: YamlConfig,
}
Expand description

Main YAML processing interface

Fields§

§config: YamlConfig

Implementations§

Source§

impl Yaml

Source

pub fn new() -> Self

Create a new YAML processor with default configuration

Source

pub fn with_loader(loader_type: LoaderType) -> Self

Create a new YAML processor with the specified loader type

Source

pub const fn with_config(config: YamlConfig) -> Self

Create a new YAML processor with custom configuration

Source

pub const fn config(&self) -> &YamlConfig

Get the current configuration

Source

pub const fn config_mut(&mut self) -> &mut YamlConfig

Get a mutable reference to the configuration

Source

pub fn load_str(&self, input: &str) -> Result<Value>

Load YAML from a string

Source

pub fn load<R: Read>(&self, reader: R) -> Result<Value>

Load YAML from a reader

Source

pub fn load_all_str(&self, input: &str) -> Result<Vec<Value>>

Load all YAML documents from a string

Source

pub fn load_all<R: Read>(&self, reader: R) -> Result<Vec<Value>>

Load all YAML documents from a reader

Source

pub fn dump_str(&self, value: &Value) -> Result<String>

Dump a YAML value to a string

Source

pub fn dump<W: Write>(&self, value: &Value, writer: W) -> Result<()>

Dump a YAML value to a writer

Source

pub fn dump_all_str(&self, values: &[Value]) -> Result<String>

Dump all YAML documents to a string

Source

pub fn dump_all<W: Write>(&self, values: &[Value], writer: W) -> Result<()>

Dump all YAML documents to a writer

Source

pub fn load_str_with_comments(&self, input: &str) -> Result<CommentedValue>

Load YAML from a string with comment preservation (RoundTrip mode only)

Source

pub fn dump_str_with_comments(&self, value: &CommentedValue) -> Result<String>

Dump a CommentedValue to a string, preserving comments

Source

pub fn dump_with_comments<W: Write>( &self, value: &CommentedValue, writer: W, ) -> Result<()>

Dump a CommentedValue to a writer, preserving comments

Source

pub fn validate_with_schema(&self, value: &Value, schema: &Schema) -> Result<()>

Validate a YAML value against a schema

Source

pub fn load_str_with_schema( &self, input: &str, schema: &Schema, ) -> Result<Value>

Load and validate YAML from a string with schema validation

Source

pub fn load_all_str_with_schema( &self, input: &str, schema: &Schema, ) -> Result<Vec<Value>>

Load and validate all YAML documents from a string with schema validation

Source

fn parse_yaml_string(&self, input: &str) -> Result<Value>

Source

fn parse_yaml_documents(&self, input: &str) -> Result<Vec<Value>>

Source

fn emit_yaml_value<W: Write>(&self, value: &Value, writer: W) -> Result<()>

Source

fn parse_yaml_string_with_comments(&self, input: &str) -> Result<CommentedValue>

Source

fn emit_commented_value<W: Write>( &self, value: &CommentedValue, writer: W, ) -> Result<()>

Source

fn emit_yaml_documents<W: Write>( &self, values: &[Value], writer: W, ) -> Result<()>

Trait Implementations§

Source§

impl Clone for Yaml

Source§

fn clone(&self) -> Yaml

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Yaml

Source§

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

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

impl Default for Yaml

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Yaml

§

impl RefUnwindSafe for Yaml

§

impl Send for Yaml

§

impl Sync for Yaml

§

impl Unpin for Yaml

§

impl UnwindSafe for Yaml

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
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.