Skip to content
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

Cannot derive conversion traits for Value #238

Open
uncomputable opened this issue Jul 24, 2024 · 3 comments
Open

Cannot derive conversion traits for Value #238

uncomputable opened this issue Jul 24, 2024 · 3 comments

Comments

@uncomputable
Copy link
Collaborator

Because the constructors of Value return Arc<Value>, it is impossible to derive From implementations in a straightforward way.

impl From<u8> for Arc<Value> {
    | ^^^^^--------^^^^^----------
    | |    |            |
    | |    |            `Arc` is not defined in the current crate
    | |    `u8` is not defined in the current crate
    | impl doesn't use only types from inside the current crate
@apoelstra
Copy link
Collaborator

Should be fixed when we replace the recursive Value implemetation with a bitslice and a type. I might give this a shot this week.

@apoelstra
Copy link
Collaborator

I gave it a quick shot, mainly to play with Deref and CoerceUnsized etc to try to make an owned and reference type, and have them interact nicely, but wasn't able to get anywhere.

So to do this, we have to do it "the normal way" without exotic Rust features, which is less fun, so I don't plan to do it in the short term unless you really want these From impls to be possible.

@uncomputable
Copy link
Collaborator Author

We can hold off on this issue for now, but I would keep it open for future reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants