feat(napi): redesign the Reference API (#1118)
- Reference now is inject by #[napi] macro - Class Reference and underlaying data now have the same lifetime
This commit is contained in:
parent
107539d906
commit
6eec0f93c1
7 changed files with 150 additions and 90 deletions
examples/napi/src
|
@ -35,11 +35,9 @@ impl JsRepo {
|
|||
}
|
||||
|
||||
#[napi]
|
||||
pub fn remote(&self) -> Result<JsRemote> {
|
||||
pub fn remote(&self, reference: Reference<JsRepo>, env: Env) -> Result<JsRemote> {
|
||||
Ok(JsRemote {
|
||||
inner: self
|
||||
.create_reference()?
|
||||
.share_with(|repo| Ok(repo.inner.remote()))?,
|
||||
inner: reference.share_with(env, |repo| Ok(repo.inner.remote()))?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue