binrw
binrw copied to clipboard
BinWrite requires writer to be Sized
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.
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
.
@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.
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.