Implement Clone for TreeCursor
Cloning was supported by the C library, but not exposed in Rust bindings
This commit is contained in:
parent
2b0de9dfec
commit
9f8ffe0164
1 changed files with 6 additions and 0 deletions
|
|
@ -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) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue