Merge pull request #911 from michalmuskala/cursor-clone

Implement Clone for TreeCursor
This commit is contained in:
Max Brunsfeld 2021-02-03 10:38:53 -08:00 committed by GitHub
commit f65b499a7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1147,6 +1147,12 @@ impl<'a> TreeCursor<'a> {
}
}
impl<'a> Clone for TreeCursor<'a> {
fn clone(&self) -> Self {
TreeCursor(unsafe { ffi::ts_tree_cursor_copy(&self.0) }, PhantomData)
}
}
impl<'a> Drop for TreeCursor<'a> {
fn drop(&mut self) {
unsafe { ffi::ts_tree_cursor_delete(&mut self.0) }