Skip to content

Commit

Permalink
Merge pull request #1048 from neon-bindings/kv/generic-ctx
Browse files Browse the repository at this point in the history
Replace all generic contexts with a single Cx type
  • Loading branch information
kjvalencik authored Aug 28, 2024
2 parents 43e0eee + d14c1e1 commit dae95b1
Show file tree
Hide file tree
Showing 8 changed files with 221 additions and 184 deletions.
10 changes: 7 additions & 3 deletions crates/neon/src/context/internal.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{cell::RefCell, ffi::c_void, mem::MaybeUninit};

use crate::{
context::ModuleContext,
context::{Cx, ModuleContext},
handle::Handle,
result::NeonResult,
sys::{self, raw},
Expand Down Expand Up @@ -46,8 +46,12 @@ impl Env {
}
}

pub trait ContextInternal<'a>: Sized {
fn env(&self) -> Env;
pub trait ContextInternal<'cx>: Sized {
fn cx(&self) -> &Cx<'cx>;
fn cx_mut(&mut self) -> &mut Cx<'cx>;
fn env(&self) -> Env {
self.cx().env
}
}

fn default_main(mut cx: ModuleContext) -> NeonResult<()> {
Expand Down
Loading

0 comments on commit dae95b1

Please sign in to comment.