Created
August 31, 2018 23:46
-
-
Save sebastiencs/9fd81a69257ad01dc71ba5f47d7f88fe to your computer and use it in GitHub Desktop.
neon.rs
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
use std::sync::RwLock; | |
use std::sync::Arc; | |
use neon::prelude::*; | |
struct Obj<'data> { | |
a: u16, | |
b: PhantomData<&'data u8> | |
} | |
pub struct User<'data> { | |
data: Arc<RwLock<Obj<'data>>>, | |
} | |
declare_types! { | |
pub class JsUser for User { | |
init(mut cx) { | |
Ok(User { | |
data: Arc::new(RwLock::new(Obj { | |
a: 0, | |
b: PhantomData | |
})) | |
}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment