Skip to content

Instantly share code, notes, and snippets.

@sebastiencs
Created August 31, 2018 23:46
Show Gist options
  • Save sebastiencs/9fd81a69257ad01dc71ba5f47d7f88fe to your computer and use it in GitHub Desktop.
Save sebastiencs/9fd81a69257ad01dc71ba5f47d7f88fe to your computer and use it in GitHub Desktop.
neon.rs
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