Trait yaml_patch::Patch[][src]

pub trait Patch {
    fn patch_from_value(&mut self, patch_value: &Value) -> Result<()>;

    fn patch_from_str(&mut self, yaml_str: &str) -> Result<()> { ... }
fn patch_from_reader<R>(&mut self, reader: R) -> Result<()>
    where
        R: Read
, { ... }
fn patch_from_key_val(&mut self, key_val_str: &str) -> Result<(), Error> { ... } }

Extends a type with mutable key-value symantics, allowing it to be "patched" with runtime yaml-derived values.

Required methods

fn patch_from_value(&mut self, patch_value: &Value) -> Result<()>[src]

Update this object to reflect the contents of a serde_yaml::Value. The rules are as follows:

  • If patch_value is not a serde_yaml::Mapping, then it is deserialized into self, if possible.

  • Otherwise, if patch_value is a serde_yaml::Mapping, then each of its values are merged into their respective data members of self using this algorithm recursively.

Loading content...

Provided methods

fn patch_from_str(&mut self, yaml_str: &str) -> Result<()>[src]

Update this object to reflect the contents of a YAML-encoded string.

fn patch_from_reader<R>(&mut self, reader: R) -> Result<()> where
    R: Read
[src]

Update this object to reflect the contents of a reader, which will yield a YAML-encoded string.

fn patch_from_key_val(&mut self, key_val_str: &str) -> Result<(), Error>[src]

Update a single, possibly nested, data member within this object using key-path style attribute access. For example, the string "company.ceo.name = Bob" would operate on a data member called company within this object, setting the name field of the ceo field to "Bob".

Loading content...

Implementors

impl<T> Patch for T where
    T: Serialize + for<'de> Deserialize<'de>, 
[src]

Loading content...