-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
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
rust: support cloning Modules #719
Conversation
Codecov Report
@@ Coverage Diff @@
## master #719 +/- ##
=======================================
Coverage 99.34% 99.34%
=======================================
Files 73 73
Lines 11125 11142 +17
=======================================
+ Hits 11052 11069 +17
Misses 73 73
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -20,10 +20,21 @@ pub struct Module(*const sys::FizzyModule); | |||
|
|||
impl Drop for Module { | |||
fn drop(&mut self) { | |||
debug_assert!(!self.0.is_null()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed these to debug_assert
and added it to all relevant places. A failure of this would mean a programming error in our code, and not user code. Hence debug_assert
, i.e. it will be caught by our tests assuming we have high enough coverage.
fn clone(&self) -> Self { | ||
debug_assert!(!self.0.is_null()); | ||
let ptr = unsafe { sys::fizzy_clone_module(self.0) }; | ||
// TODO: this can be zero in case of memory allocation error, should this be gracefully handled? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That being said the clone trait does not support optionality.
No description provided.