Created
July 10, 2018 05:59
-
-
Save dherman/e726a6e3dc96bd7b14d4c55d17cca6c5 to your computer and use it in GitHub Desktop.
This file contains 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
pub trait IntoJs<'a, V: Value> { | |
fn into_js<C: Context<'a>>(self, cx: &mut C) -> Handle<'a, V>; | |
} | |
impl<'a, V: Value> IntoJs<'a, V> for Handle<'a, V> { | |
fn into_js<C: Context<'a>>(self, _: &mut C) -> Handle<'a, V> { | |
self | |
} | |
} | |
impl<'a, 'b> IntoJs<'a, JsString> for &'b str { | |
fn into_js<C: Context<'a>>(self, cx: &mut C) -> Handle<'a, JsString> { | |
cx.string(self) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment