Skip to content

Support transmuting Ref<B, T> into Ref<B, U> #2133

@joshlf

Description

@joshlf
Member

Given T: IntoBytes and U: FromBytes, we use the same logic as transmute_ref!, only with Ref instead of references. This will need to be fallible for size and alignment reasons.

This would permit Fuchsia's Netstack3 to implement this code generically, e.g. replacing pub fn as_v1_query(&self) -> Mldv1Body<&[u8]> with pub fn into_v1_query(self) -> Mldv1Body<B>.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @joshlf

        Issue actions

          Support transmuting `Ref<B, T>` into `Ref<B, U>` · Issue #2133 · google/zerocopy