pub struct YamlHash { /* private fields */ }
Expand description
Improved YAML Hash
Implementations§
source§impl YamlHash
impl YamlHash
sourcepub fn merge(&self, other: &YamlHash) -> Result<YamlHash>
pub fn merge(&self, other: &YamlHash) -> Result<YamlHash>
Merge this YamlHash
with another YamlHash
to create a new YamlHash
use yaml_hash::YamlHash;
let hash = YamlHash::from("\
fruit:
apple: 1
banana: 2\
");
let other = YamlHash::from("\
fruit:
cherry:
sweet: 1
tart: 2\
");
assert_eq!(
hash.merge(&other).unwrap().to_string(),
"\
fruit:
apple: 1
banana: 2
cherry:
sweet: 1
tart: 2\
",
);
sourcepub fn merge_str(&self, s: &str) -> Result<YamlHash>
pub fn merge_str(&self, s: &str) -> Result<YamlHash>
Merge this YamlHash
with a YAML hash &str
to create a new YamlHash
use yaml_hash::YamlHash;
let hash = YamlHash::from("\
fruit:
apple: 1
banana: 2\
");
let hash = hash.merge_str("\
fruit:
cherry:
sweet: 1
tart: 2\
").unwrap();
assert_eq!(
hash.to_string(),
"\
fruit:
apple: 1
banana: 2
cherry:
sweet: 1
tart: 2\
",
);
sourcepub fn merge_file(&self, s: &str) -> Result<YamlHash>
pub fn merge_file(&self, s: &str) -> Result<YamlHash>
Trait Implementations§
source§impl PartialEq for YamlHash
impl PartialEq for YamlHash
impl Eq for YamlHash
impl StructuralPartialEq for YamlHash
Auto Trait Implementations§
impl Freeze for YamlHash
impl RefUnwindSafe for YamlHash
impl Send for YamlHash
impl Sync for YamlHash
impl Unpin for YamlHash
impl UnwindSafe for YamlHash
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