Skip to content

Commit a994bbb

Browse files
committed
document unsafe functions
1 parent 8a7159c commit a994bbb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ impl<T> Tree<T> {
172172
}
173173

174174
/// Returns a reference to the specified node.
175+
/// # Safety
176+
/// The caller must ensure that `id` is a valid node ID.
175177
pub unsafe fn get_unchecked(&self, id: NodeId) -> NodeRef<T> {
176178
NodeRef {
177179
id,
@@ -181,6 +183,8 @@ impl<T> Tree<T> {
181183
}
182184

183185
/// Returns a mutator of the specified node.
186+
/// # Safety
187+
/// The caller must ensure that `id` is a valid node ID.
184188
pub unsafe fn get_unchecked_mut(&mut self, id: NodeId) -> NodeMut<T> {
185189
NodeMut { id, tree: self }
186190
}

0 commit comments

Comments
 (0)