yaml: add YamlLoader::documents() to get a read-only view of the parsed documents

This commit is contained in:
David Aguilar 2024-03-23 22:42:58 -07:00
parent eddea11e01
commit a5550d4203

View file

@ -239,6 +239,12 @@ impl YamlLoader {
parser.load(&mut loader, true)?; parser.load(&mut loader, true)?;
Ok(loader.docs) Ok(loader.docs)
} }
/// Return a reference to the parsed Yaml documents.
#[must_use]
pub fn documents(&self) -> &[Yaml] {
&self.docs
}
} }
/// The signature of the function to call when using [`YAMLDecodingTrap::Call`]. /// The signature of the function to call when using [`YAMLDecodingTrap::Call`].