Skip to content

Commit 06a52df

Browse files
committed
Add TryFromBytes trait
`TryFromBytes` can be implemented for types which are not `FromZeroes` or `FromBytes`; it supports performing a runtime check to determine whether a given byte sequence contains a valid instance of `Self`. This is the first step of #5. Future commits will add support for a custom derive and for implementing `TryFromBytes` on unsized types. TODO: - More thorough tests for non-FromBytes types (bool, char, etc) - Document TryFromBytes requirements regarding UnsafeCell - Remove now-unnecessary safety comment on `impl_try_from_bytes_testable!` (both definition and usage sites) - Remove the TODO comment on the definition of `unsafe_impl!` - Remove the TODO to test the failure branch of `unsafe_impl!` using trybuild Makes progress on #5
1 parent 80c12cf commit 06a52df

File tree

3 files changed

+890
-164
lines changed

3 files changed

+890
-164
lines changed

0 commit comments

Comments
 (0)