Browse Source

Feature `gc` module (#694)

pull/695/head
Halid Odat 4 years ago committed by GitHub
parent
commit
81089d1377
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      boa/examples/classes.rs
  2. 3
      boa/src/class.rs
  3. 11
      boa/src/gc.rs
  4. 2
      boa/src/lib.rs

3
boa/examples/classes.rs

@ -1,7 +1,8 @@
use boa::{
class::{Class, ClassBuilder},
gc::{Finalize, Trace},
property::Attribute,
Context, Finalize, Result, Trace, Value,
Context, Result, Value,
};
// We create a new struct that is going to represent a person.

3
boa/src/class.rs

@ -5,7 +5,8 @@
//!# use boa::{
//!# property::Attribute,
//!# class::{Class, ClassBuilder},
//!# Context, Finalize, Result, Trace, Value,
//!# gc::{Finalize, Trace},
//!# Context, Result, Value,
//!# };
//!#
//! // This does not have to be an enum it can also be a struct.

11
boa/src/gc.rs

@ -0,0 +1,11 @@
//! This module represents the main way to interact with the garbacge collector.
// This is because `rust-gc` unsafe_empty_trace has a `unsafe_`
// when it should be `empty_trace`.
#![allow(clippy::unsafe_removed_from_name)]
pub use crate::object::GcObject;
pub use ::gc::{
custom_trace, force_collect, unsafe_empty_trace as empty_trace, Finalize, GcCellRef as Ref,
GcCellRefMut as RefMut, Trace,
};

2
boa/src/lib.rs

@ -38,6 +38,7 @@ pub mod builtins;
pub mod class;
pub mod environment;
pub mod exec;
pub mod gc;
pub mod object;
pub mod profiler;
pub mod property;
@ -50,7 +51,6 @@ mod context;
use std::result::Result as StdResult;
pub(crate) use crate::{exec::Executable, profiler::BoaProfiler};
pub use gc::{custom_trace, unsafe_empty_trace, Finalize, Trace};
// Export things to root level
pub use crate::{context::Context, value::Value};

Loading…
Cancel
Save