Skip to content

Add support for Encode and Decode of Pin<Box<T>>#106

Open
nixpulvis wants to merge 1 commit intoSoftbearStudios:mainfrom
nixpulvis:pin-support
Open

Add support for Encode and Decode of Pin<Box<T>>#106
nixpulvis wants to merge 1 commit intoSoftbearStudios:mainfrom
nixpulvis:pin-support

Conversation

@nixpulvis
Copy link
Copy Markdown

Allows for encoding and decoding things like Pin<Box<T>>.

Closes #104

@finnbear
Copy link
Copy Markdown
Member

Thanks, I'm curious, why not do it the simple way?
image

(#104 (comment))

@nixpulvis
Copy link
Copy Markdown
Author

I tried it, but it failed on conflicted impls. Perhaps you know more about that. I could dig more into it tomorrow perhaps.

@finnbear
Copy link
Copy Markdown
Member

finnbear commented Mar 31, 2026

Thanks, idk what happened, but my copy of bitcode seemed to compile with that line. When I tried again, it failed as you saw. Maybe the file didn't save after I edited it the first time.

It seems the issue is Pin<T> does not implement From<T> for any T, just Box<...>: https://doc.rust-lang.org/std/pin/struct.Pin.html#impl-From%3CBox%3CT,+A%3E%3E-for-Pin%3CBox%3CT,+A%3E%3E (and there is a similar restriction for Deref).

In light of that, I agree with your approach.

Please remove the unnecessary Deref bound from Decode and fix the formatting issue that the Build CI is failing on. The MSRV issue isn't your fault.

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.

Derive Encode/Decode for Pinned Types

2 participants