Implement Clone for TreeCursor

Cloning was supported by the C library, but not exposed in Rust bindings
This commit is contained in:
Michał Muskała 2021-02-03 17:15:42 +00:00
parent 2b0de9dfec
commit 9f8ffe0164

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) }