-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use smart pointers? #23
Comments
You may need to add generic implementation for this smartpointer. |
Where do I find the implementation? The only place Box comes up as a string in the code is in the |
Not sure if it's the cleanest way but here's what I came up with. The annoying bit is that any struct that uses Rc now needs to be broken out into an explicit formula unless there's an obvious way to connect RcFormula to Rc or I should be doing something else? Certainly nothing as elegant as Box & I couldn't find where in the code
|
I've added implementation for Box, Rc and Arc in |
Ow wow! Did not know expect that, thanks! I also may have 3p smart pointers (eg I use hybrid_rc although not sure it'll come up here necessarily). I'm assuming there's no good way to do this generically since I can't impl Serialize/Deserialize for external crates, so I'll need to write wrappers or explicit formulas instead? |
Take note that Box cannot be a generic Like this: #[derive(alkahest_proc::Formula)]
struct Foo {
a: u32,
}
#[alkahest(SerializeRef<Foo>, Deserialize<'_, Foo>)]
struct FooWithBox {
a: Box<u32>,
} |
You can add impls to this crate with optional dependency Or in their crate instead :) |
If I want to have a Serialize that contains an Rc<Vec>, is there a way to do this?
The text was updated successfully, but these errors were encountered: