pub struct Transformer { /* private fields */ }
Expand description
Processing yaml with include documents through !include <path>
tag.
§Features
- include and parse recursively
yaml
(andjson
) files - include
markdown
andtxt
text files - include other types as
base64
encoded binary data. - optionaly handle gracefully circular references with
!circular
tag
§Example
use std::path::PathBuf;
use yaml_include::Transformer;
let path = PathBuf::from("data/sample/main.yml");
if let Ok(transformer) = Transformer::new(path, false) {
println!("{}", transformer);
};
Implementations§
Source§impl Transformer
impl Transformer
Sourcepub fn new(root_path: PathBuf, strict: bool) -> Result<Self>
pub fn new(root_path: PathBuf, strict: bool) -> Result<Self>
Instance a transformer from a yaml file path.
§Example:
use std::path::PathBuf;
use yaml_include::Transformer;
let path = PathBuf::from("data/sample/main.yml");
if let Ok(transformer) = Transformer::new(path, false) {
dbg!(transformer);
};
Sourcepub fn parse(&self) -> Value
pub fn parse(&self) -> Value
Parse yaml with recursively processing !include
§Example:
use std::path::PathBuf;
use yaml_include::Transformer;
let path = PathBuf::from("data/sample/main.yml");
if let Ok(transformer) = Transformer::new(path, false) {
let parsed = transformer.parse();
dbg!(parsed);
};
Trait Implementations§
Source§impl Clone for Transformer
impl Clone for Transformer
Source§fn clone(&self) -> Transformer
fn clone(&self) -> Transformer
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Transformer
impl Debug for Transformer
Auto Trait Implementations§
impl Freeze for Transformer
impl RefUnwindSafe for Transformer
impl Send for Transformer
impl Sync for Transformer
impl Unpin for Transformer
impl UnwindSafe for Transformer
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