Closed as-com closed 6 months ago
Attention: Patch coverage is 16.66667%
with 10 lines
in your changes are missing coverage. Please review.
Project coverage is 51.69%. Comparing base (
ab342b3
) to head (9522881
). Report is 4 commits behind head on master.
Files | Patch % | Lines |
---|---|---|
capnp/src/primitive_list.rs | 16.66% | 10 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks!
Somewhat related to #496 - if the user enables the
unaligned
feature, undefined behavior may result from use ofas_slice()
if the type is larger than 1 byte.I added a compile-time check that panics in a const fn for a more useful error message and to keep the API the same. This also adds support for
as_slice()
on big-endian targets so long as the lists' elements are 1 byte or less.Possible alternatives include:
None
if the buffer is unaligned, but still returning a slice if it happens to be alignedNone
if theunaligned
feature is enabled for lists of multi-byte elements#[cfg(...)]
-gating the entire method