Consume context on destroy
This commit is contained in:
parent
b2671b10bd
commit
dfe5157e87
3 changed files with 3 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
/target
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
||||
.idea
|
||||
|
|
|
@ -10,4 +10,4 @@ license = "Unlicense"
|
|||
description = "Safe(er) rust wrapper for dukbind."
|
||||
|
||||
[dependencies]
|
||||
dukbind = "0.0.4"
|
||||
dukbind = { path = "../dukbind" }
|
||||
|
|
|
@ -370,10 +370,9 @@ impl DukContext {
|
|||
}
|
||||
}
|
||||
/// Destroy the duktape context's heap. Should not be used after calling this.
|
||||
pub fn destroy(&mut self) {
|
||||
pub fn destroy(self) {
|
||||
unsafe {
|
||||
duk_destroy_heap(self.ctx.expect("Invalid context pointer."));
|
||||
self.ctx = None;
|
||||
}
|
||||
}
|
||||
/// Decode a JSON string into the context, returning a DukObject.
|
||||
|
|
Loading…
Reference in a new issue