We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Work going on over in #296 risks code duplication. To eliminate this, we need to separate out the public API of a tree from its storage requirements.
Roughly, something like this should do the trick:
// Gets the public API struct TreeApi { tree: NonNull<ll_bindings::tsk_tree_t>, } // Worries about storage, Drop, etc.. struct TreeTest { tree: ll_bindings::tsk_tree_t, api: TreeApi, } impl TreeTest { fn new(ts: TreeSequence) -> Self { let mut m = MaybeUninit::<ll_bindings::tsk_tree_t>::uninit(); let rv = unsafe { ll_bindings::tsk_tree_init(m.as_mut_ptr(), ts.as_ptr(), 0) }; assert_eq!(rv, 0); let mut tree = unsafe { m.assume_init() }; let tp = &mut tree as *mut ll_bindings::tsk_tree_t; Self { tree, api: TreeApi { tree: unsafe { NonNull::new_unchecked(tp) }, }, } } }
Once done, we can have separate owning/non-owning Tree types.
The text was updated successfully, but these errors were encountered:
Closed by #300
Sorry, something went wrong.
No branches or pull requests
Work going on over in #296 risks code duplication.
To eliminate this, we need to separate out the public
API of a tree from its storage requirements.
Roughly, something like this should do the trick:
Once done, we can have separate owning/non-owning Tree types.
The text was updated successfully, but these errors were encountered: