Skip to content

Commit c65c966

Browse files
Update README.md
I've changed two instances of struct fields whose type is a garbage-collected handle to the struct type itself. It seemed unlikely that there was a safe way to create instances of the type, a point which caused some confusion among readers. The type was changed to `Option<Gc<Foo>>`, which is I think is the right call, though it could also have been `Gc<Option<Foo>>`; I don't have much experience with the library, and if you think the second type is more idiomatic let me know.
1 parent d4f5683 commit c65c966

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use gc::Gc;
3333

3434
#[derive(Trace, Finalize)]
3535
struct Foo {
36-
x: Gc<Foo>,
36+
x: Option<Gc<Foo>>,
3737
y: u8,
3838
// ...
3939
}
@@ -81,7 +81,7 @@ use bar::Baz;
8181

8282
#[derive(Trace, Finalize)]
8383
struct Foo {
84-
x: Gc<Foo>,
84+
x: Option<Gc<Foo>>,
8585
#[unsafe_ignore_trace]
8686
y: Baz, // we are assuming that `Baz` doesn't contain any `Gc` objects
8787
// ...

0 commit comments

Comments
 (0)