docs(rust): update doc comment on node ids

This commit is contained in:
StratusFearMe21 2024-12-16 03:52:46 +00:00 committed by GitHub
parent f279d10aa2
commit c053b63be8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1493,10 +1493,14 @@ impl<'tree> Node<'tree> {
/// Get a numeric id for this node that is unique.
///
/// Within a given syntax tree, no two nodes have the same id. However, if
/// a new tree is created based on an older tree, and a node from the old
/// tree is reused in the process, then that node will have the same id in
/// both trees.
/// Within a given syntax tree, no two nodes have the same id. However:
///
/// - If a new tree is created based on an older tree, and a node from the old tree is reused in
/// the process, then that node will have the same id in both trees.
///
/// - A node not marked as having changes does not guarantee it was reused.
///
/// - If a node is marked as having changed in the old tree, it will not be reused.
#[must_use]
pub fn id(&self) -> usize {
self.0.id as usize