-
Notifications
You must be signed in to change notification settings - Fork 122
Closed
Description
Should we impl TryFromBytes
for Unalign<T>
where T: TryFromBytes
? There are a few cases, and many of them are thorny:
- For
T: Unaligned
, we could already support this by delegating toT::is_bit_valid
. - For
T: !Unaligned
(ie,T
in the general case without anUnaligned
bound), we can't delegate toT::is_bit_valid
because it requires an alignedMaybeValid<T>
. We could copy theUnalign<T>
into the local stack frame in order to ensure its alignment and then callT::is_bit_valid
on the local copy, but that could be very expensive. - If we add support for unsized
T
, then forT: !Unaligned
, copying into the local stack frame isn't even an option.
cc @kupiakos
Metadata
Metadata
Assignees
Labels
No labels