Skip to content
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

Implement `AsHandle` and `AsHandleMut` traits. #320

Closed
wants to merge 2 commits into from

Commits on Nov 22, 2016

  1. Add methods to create a HandleValueArray.

    Rust-mozjs currently does not define any methods to create instances of HandleValueArray.
    Consequently, consumers have to create these instances manually. This is unnecessary boilerplate,
    and therefore should be abstracted behind a function.
    ejpbruel committed Nov 22, 2016
  2. Implement `AsHandle` and `AsHandleMut` traits.

    Several types in rust-mozjs, such as Heap, PersistentRooted, and RootedGuard, represent a rooted
    value. A common property of rooted values is that a handle can be obtained to it. Rather than
    implement this property separately for each of these types, we should abstract it out into these
    two traits.
    
    This has several advantages: for instance, one can write functions that take any rooted value as
    argument, regardless of how it is implemented, and then obtain a handle to it. Additionally, it
    allows one to implement these traits for newtypes which underlying type is a rooted value.
    ejpbruel committed Nov 22, 2016
You can’t perform that action at this time.