Skip to content

Support container conversions (and maybe other container types?) #114

@joshlf

Description

@joshlf

For two possible approaches, see #1183 and #1735.

Currently, we support T -> U conversions using the transmute! macro when T: AsBytes, U: FromBytes, and T and U have the same size. In principle, we ought to be able to support a range of conversions for container types wrapping T and U so long as those containers have well-defined layouts. Specifically:

  • Slices
  • Box (the docs guarantee Box's layout for Sized types)
  • ManuallyDrop (the docs guarantee that ManuallyDrop<T>'s layout is equivalent to T's)
  • Wrapping (the docs guarantee that Wrapping<T>'s layout is equivalent to T's)

...and possibly others.

This will help unblock ICU4X using zerocopy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions