diff --git a/src/document.rs b/src/document.rs index a0d0713..4221b79 100644 --- a/src/document.rs +++ b/src/document.rs @@ -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.