mirror of
https://github.com/simonask/libyaml-safer
synced 2024-11-25 21:00:25 +00:00
Allow non-mutable access to Document nodes
This commit is contained in:
parent
5b9dcd7a15
commit
0d9097344a
1 changed files with 8 additions and 1 deletions
|
@ -115,10 +115,17 @@ impl Document {
|
|||
/// Get a node of a YAML document.
|
||||
///
|
||||
/// Returns the node object or `None` if `index` is out of range.
|
||||
pub fn get_node(&mut self, index: i32) -> Option<&mut Node> {
|
||||
pub fn get_node_mut(&mut self, index: i32) -> Option<&mut Node> {
|
||||
self.nodes.get_mut(index as usize - 1)
|
||||
}
|
||||
|
||||
/// Get a node of a YAML document.
|
||||
///
|
||||
/// Returns the node object or `None` if `index` is out of range.
|
||||
pub fn get_node(&self, index: i32) -> Option<&Node> {
|
||||
self.nodes.get(index as usize - 1)
|
||||
}
|
||||
|
||||
/// Get the root of a YAML document node.
|
||||
///
|
||||
/// The root object is the first object added to the document.
|
||||
|
|
Loading…
Reference in a new issue