mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Mention the usecase of Traceable/Untraceable.
This commit is contained in:
parent
dae6ad409d
commit
2477e6feac
1 changed files with 6 additions and 0 deletions
|
@ -77,6 +77,9 @@ pub fn trace_object(tracer: *mut JSTracer, description: &str, obj: *mut JSObject
|
||||||
/// but also does not need to be made known to the SpiderMonkey garbage collector.
|
/// but also does not need to be made known to the SpiderMonkey garbage collector.
|
||||||
/// Use only with types that are not associated with a JS reflector and do not contain
|
/// Use only with types that are not associated with a JS reflector and do not contain
|
||||||
/// fields of types associated with JS reflectors.
|
/// fields of types associated with JS reflectors.
|
||||||
|
///
|
||||||
|
/// This should really only be used for types that are from other crates,
|
||||||
|
/// so we can't implement `Encodable`. See more details: mozilla#2662.
|
||||||
pub struct Untraceable<T> {
|
pub struct Untraceable<T> {
|
||||||
inner: T,
|
inner: T,
|
||||||
}
|
}
|
||||||
|
@ -110,6 +113,9 @@ impl<T> DerefMut<T> for Untraceable<T> {
|
||||||
/// Encapsulates a type that can be traced but is boxed in a type we don't control
|
/// Encapsulates a type that can be traced but is boxed in a type we don't control
|
||||||
/// (such as RefCell). Wrap a field in Traceable and implement the Encodable trait
|
/// (such as RefCell). Wrap a field in Traceable and implement the Encodable trait
|
||||||
/// for that new concrete type to achieve magic compiler-derived trace hooks.
|
/// for that new concrete type to achieve magic compiler-derived trace hooks.
|
||||||
|
///
|
||||||
|
/// We always prefer this, in case the contained type ever changes to something that should be traced.
|
||||||
|
/// See more details: mozilla#2662.
|
||||||
#[deriving(Eq, Clone)]
|
#[deriving(Eq, Clone)]
|
||||||
pub struct Traceable<T> {
|
pub struct Traceable<T> {
|
||||||
inner: T
|
inner: T
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue