Closed glyh closed 1 month ago
For now attempting this directly with rust lifetime params I got a "lifetime should be at least as long as 'static" error.
Generally you can't mix other non-'static lifetimes than 'gc into gc-arena, but it sorta depends. Am I understanding things correctly that you want to keep around a &'a &'static str
or a &'a mut &'static str
, and not just a &'static str
?
I want to keep around a 'static
inside a 'gc
, I guess RefCell
is the way to go?
I need this just for &static str
, though. I guess for this case I can also use a &String
?
You can keep around a &'static T
inside the arena, there is no need for RefCell
at all are you maybe missing a no never mind, this should work by default, #[collect(require_static)]
on the field?&'static T
always implements Collect
so you shouldn't even need that.
If you can give me an example that doesn't compile I can probably provide more specific help.
This might be the way to go, I'll take a look at this. Thank you!
Ah, I may have told you incorrectly if you didn't see my edit, I'm sorry!
If you can't figure it out, feel free to follow up. If you can show me what error you're seeing and a code sample I can help.
My use case is basically storing a constant
&str
inside a GC'ed tagged enum(which is also recursive).I've read through the example but I didn't find something like this. I would appreciate it if you can provide some examples, thank you!