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

BinWrite requires writer to be Sized #104

Open
Wesmania opened this issue Feb 28, 2022 · 3 comments
Open

BinWrite requires writer to be Sized #104

Wesmania opened this issue Feb 28, 2022 · 3 comments
Assignees

Comments

@Wesmania
Copy link

There doesn't seem to be any good reason for writer to be sized, since it's just a mutable reference. Without ?Sized, it's impossible to use trait objects with BinWrite.

@dmgolembiowski
Copy link
Contributor

dmgolembiowski commented Mar 7, 2022

There doesn't seem to be any good reason for writer to be sized, since it's just a mutable reference. Without ?Sized, it's impossible to use trait objects with BinWrite.

I dug into this and it appears you're right. However dropping from Sized to ?Sized on the writer-related aspects of this causes a boatload of tests to fail that use #[binrw]'s decorator. Implementors using #[binrw] have a self that is both Sized and ?Sized.

csnover added a commit to csnover/binrw that referenced this issue Aug 19, 2022
csnover added a commit to csnover/binrw that referenced this issue Aug 19, 2022
@csnover csnover self-assigned this Aug 19, 2022
csnover added a commit to csnover/binrw that referenced this issue Aug 22, 2022
csnover added a commit to csnover/binrw that referenced this issue Aug 23, 2022
csnover added a commit to csnover/binrw that referenced this issue Aug 23, 2022
@csnover
Copy link
Collaborator

csnover commented Aug 23, 2022

@Wesmania can you provide any more information about what you were trying to do? Currently trying to decide whether or not it is worth the pain of changing this since doing so would break every existing user with a custom parser/serialiser function or manual impl of BinRead/BinWrite.

@Wesmania
Copy link
Author

I have a simple tool for serializing / deserializing a data format here. From what I remember this was just a convenience thing that would allow easily writing to either a file or standard output and I worked around it anyway.

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 a pull request may close this issue.

3 participants