Created
May 30, 2018 00:41
-
-
Save nikomatsakis/edb2b47e8df58895f5ada619647f455b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Head: vm2 WIP: convenient shorthand API for borrowing a single value | |
Merge: origin/vm2 WIP: convenient shorthand API for borrowing a single value | |
Tag: 0.1.22 (26) | |
Unstaged changes (2) | |
modified src/vm.rs | |
@@ -349,8 +349,8 @@ pub trait Context<'a>: ContextInternal<'a> { | |
VmGuard::new() | |
} | |
- fn borrow<V: Value, T, F: for<'b> FnOnce(Ref<'b, <&'b V as Borrow>::Target>) -> T>(&self, v: Handle<V>, f: F) -> T | |
- where for<'b> &'b V: Borrow | |
+ fn borrow<'c, V: Value, T, F: for<'b> FnOnce(Ref<'b, <&'c V as Borrow>::Target>) -> T>(&self, v: &'c Handle<V>, f: F) -> T | |
+ where &'c V: Borrow | |
{ | |
let guard = self.lock(); | |
let contents = v.borrow(&guard); | |
modified test/dynamic/native/src/js/classes.rs | |
@@ -1,3 +1,5 @@ | |
+#![allow(warnings)] | |
+ | |
use neon::js::{JsString, JsNumber, Borrow}; | |
use neon::mem::Handle; | |
use neon::js::error::{JsError, Kind}; | |
@@ -55,7 +57,7 @@ declare_types! { | |
match &attr[..] { | |
"id" => { | |
- let id = cx.borrow(this, |user| { /*let user = &user; user.id*/ 33 }); | |
+ let id = cx.borrow(&this, |user| { /*let user = &user; user.id*/ 33 }); | |
/* | |
let id = { | |
let guard = cx.lock(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment