bincode icon indicating copy to clipboard operation
bincode copied to clipboard

Can bincode::serialize error?

Open Ekleog opened this issue 4 years ago • 6 comments

As far as I can see, bincode::serialize cannot actually return an Err.

If it cannot, maybe this could be documented (and hopefully the return type changed to Vec<u8> if/when v2 gets out)?

If it can, hopefully the ways in which it can return an Err could be documented, as there is no obvious case I could think of?

Anyway, thank you for bincode! I'm still starting using it, but it looks really neat :)

Ekleog avatar Dec 12 '19 22:12 Ekleog

It could return an error if the Serialize implementation of the serialized type calls a method that is not supported by bincode. For example, if it calls serialize_seq with a len of None

ZoeyR avatar Apr 16 '20 04:04 ZoeyR

Ooh good to know, thank you :) Going to leave this open for tracking the “include in the docs”, then, I guess

Ekleog avatar Apr 16 '20 11:04 Ekleog

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 13 '21 21:06 stale[bot]

Not stale

Ekleog avatar Jun 13 '21 22:06 Ekleog

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 12 '21 23:08 stale[bot]

https://github.com/bincode-org/bincode/issues/293#issuecomment-614597852 is still in need of action as of current master.

dtolnay avatar Aug 13 '21 00:08 dtolnay