-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use inspector db directly in js #9
Conversation
src/tracing/js/bindings.rs
Outdated
/// Creates a garbage collectible value to the given reference. | ||
/// | ||
/// SAFETY; the caller must ensure that the guard is dropped before the value is dropped. | ||
pub(crate) fn r#ref(val: &Val) -> (Self, GcGuard<'_, Val>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new_ instead of r#?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have new, this calls Self::new
with a ref value, the function match the enum variants
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I meant new_ref instead of #ref
Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, weird Gc stuff is fine as long as it's private
Closes #6
This gets rid of the additional JS service requirement by transmuting the db reference and guarding it against garbage collection.
This applies a similar transmute hack as
std::thread::scoped
by transmuting the lifetime bound of the DB via a trait object.The DB wrappers are nullable, once the guard is dropped the actual garbage collected DB reference is also removed