Skip to content

Add more JsonRawValue encode/decode impls. #3859

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Dirbaio
Copy link

@Dirbaio Dirbaio commented May 15, 2025

This PR adds a Decode impl for Box<JsonRawValue>. This allows keeping structs that implement FromRow lifetime-free,
previously you had to use &'a JsonRawValue.

struct Foo {
    bar: Box<JsonRawValue>,
}

I've also added Encode impls for JsonRawValue. There was a comment stating "We don't have to implement Encode for JsonRawValue because that's covered by the default implementation for Encode" but as far as I can tell that's not true, no default impl would cover JsonRawValue.

Dirbaio added 2 commits May 15, 2025 15:04
This allows keeping structs that implement FromRow lifetime-free,
previously you had to use `&'a JsonRawValue`.

```rust
struct Foo {
    bar: Box<JsonRawValue>,
}
```
@Dirbaio Dirbaio changed the title Add support for Box<JsonRawValue> types. Add more JsonRawValue encode/decode impls. May 15, 2025
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

Successfully merging this pull request may close these issues.

1 participant