-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
I try to use this library, but I have a lot of things I don't understand.
for version 0.2.0-alpha.1
I want to implement the following types, are there any design problems?
type GcCollector = zerogc::dummy_impl::DummyCollectorId;
type GcValue<'gc> = Gc<'gc, Value<'gc>, GcCollector>;
type GcString<'gc> = Gc<'gc, String, GcCollector>;
#[derive(Debug, Clone, Trace)]
pub enum Value<'gc> {
Null,
Boolean(bool),
String(GcString<'gc>),
Array(Vec<GcValue<'gc>>),
Object(HashMap<GcString<'gc>, GcValue<'gc>>),
}How to deal with missing
TraceImmutable?
error[E0277]: the trait bound `Gc<'gc, String, DummyCollectorId>: TraceImmutable` is not satisfied
--> projects\nyar-interpreter\src\value\mod.rs:13:24
|
13 | #[derive(Debug, Clone, Trace)]
| ^^^^^ the trait `TraceImmutable` is not implemented for `Gc<'gc, String, DummyCollectorId>`
|
= note: required because of the requirements on the impl of `Trace` for `HashMap<Gc<'gc, String, DummyCollectorId>, Gc<'gc, value::Value<'gc>, DummyCollectorId>>`
= note: required by `NEEDS_TRACE`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)How to deal with missing
GcRebrand
#[derive(Debug, Clone, Trace)]
pub enum Value<'gc> {
Null,
Boolean(bool),
String(GcString<'gc>),
Array(Vec<GcValue<'gc>>),
Object(HashMap<String, GcValue<'gc>>),
}error[E0277]: the trait bound `Gc<'gc, String, DummyCollectorId>: GcRebrand<'new_gc, Id>` is not satisfied
--> projects\nyar-interpreter\src\value\mod.rs:17:12
|
17 | String(GcString<'gc>),
| ^^^^^^^^^^^^^ the trait `GcRebrand<'new_gc, Id>` is not implemented for `Gc<'gc, String, DummyCollectorId>`
|
= note: required by `assert_rebrand`
help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement
|
14 | pub enum Value<'gc> where Gc<'gc, String, DummyCollectorId>: GcRebrand<'new_gc, Id> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^How to deal with missing types such as
VecDeque, which trait bounds need to be implemented manually
#[derive(Debug, Clone, Trace)]
pub enum Value<'gc> {
Null,
Boolean(bool),
String(GcString<'gc>),
Array(VecDeque<GcValue<'gc>>),
Object(HashMap<String, GcValue<'gc>>),
}error[E0277]: the trait bound `VecDeque<Gc<'gc, value::Value<'gc>, DummyCollectorId>>: Trace` is not satisfied
--> projects\nyar-interpreter\src\value\mod.rs:13:24
|
13 | #[derive(Debug, Clone, Trace)]
| ^^^^^ the trait `Trace` is not implemented for `VecDeque<Gc<'gc, value::Value<'gc>, DummyCollectorId>>`
|
= note: required by `NEEDS_TRACE`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)Metadata
Metadata
Assignees
Labels
No labels