Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
joshlf opened this issue Dec 5, 2024 · 0 comments
Open

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

joshlf opened this issue Dec 5, 2024 · 0 comments
Labels
customer-request Documents customer requests.

Comments

@joshlf
Copy link
Member

joshlf commented Dec 5, 2024

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>.

@joshlf joshlf added the customer-request Documents customer requests. label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-request Documents customer requests.
Projects
None yet
Development

No branches or pull requests

1 participant