Skip to content

Commit

Permalink
Add Yaml::is_hash.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethiraric committed Sep 24, 2024
1 parent fed96b2 commit c2069fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Parse empty scalars as `""` instead of `"~"`.

**Features**
- Add `Yaml::is_hash`.
- Add better doccomments to the `Index` and `IntoIterator` implementations for
`Yaml` to better explain their quirks and design decisions.

Expand Down
6 changes: 6 additions & 0 deletions src/yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,12 @@ impl Yaml {
matches!(*self, Yaml::Array(_))
}

/// Return whether `self` is a [`Yaml::Hash`] node.
#[must_use]
pub fn is_hash(&self) -> bool {
matches!(*self, Yaml::Hash(_))
}

/// Return the `f64` value contained in this YAML node.
///
/// If the node is not a [`Yaml::Real`] YAML node or its contents is not a valid `f64` string,
Expand Down

0 comments on commit c2069fc

Please sign in to comment.