Skip to content

Conversation

@guissalustiano
Copy link
Contributor

@guissalustiano guissalustiano commented May 26, 2025

I'm using Box to use less space on heap and would like to write it direct to the database with diesel

@lsunsi
Copy link
Contributor

lsunsi commented May 27, 2025

@guissalustiano according to #4613 you might be missing some spots (:

@weiznich
Copy link
Member

Yes it would be great to have it for the other Text like types as well and not only for Citext. Also some tests are necessary before accepting this.

@guissalustiano
Copy link
Contributor Author

Thanks for the return, I'll implement this!

@guissalustiano guissalustiano marked this pull request as draft May 28, 2025 11:28
@LucaCappelletti94
Copy link
Contributor

It is possible that PR #4610 will superseed this one as, following one of the PR change requests, I have added a blanket implementation for theToSql and FromSql traits for the Box struct.

@guissalustiano
Copy link
Contributor Author

guissalustiano commented May 31, 2025

I didn't see that, thanks @LucaCappelletti94

@LucaCappelletti94
Copy link
Contributor

I suggest to not close this PR until @weiznich says so, as it is still possible that there are issues with my own PR. Still, I just thought it important to comment that the two PRs are in collision for the implementation of traits for the Box.

@weiznich
Copy link
Member

weiznich commented Jun 2, 2025

#4610 is slightly different than this PR. With what's currently implemented in that other PR it should be possible to load/store values from any Arc<T>/Rc<T>/Box<T> field where the T implements FromSql or ToSql.

At least for T == str and FromSql that's not the case yet, as you cannot create a unboxed (or arc/rc) str value out of nowhere. So in the end both PR's are somewhat required to address both slightly different uses-cases. That written it totally makes sense to support Rc<str> and Arc<str> here as well.

So yes, literally the change in this PR is made obsolete by the other PR but there are similar features that might still be useful to add.

@guissalustiano guissalustiano reopened this Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants