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

Add MaybeUninit type #319

Conversation

joshlf
Copy link
Member

@joshlf joshlf commented Sep 3, 2023

The standard library's MaybeUninit type does not currently support wrapping unsized types. This commit introduces a polyfill with the same behavior as MaybeUninit which does support wrapping unsized types.

In this commit, the only supported types are sized types and slice types. Later (as part of #29), we will add the ability to derive the AsMaybeUninit trait, which will extend support to custom DSTs.

Makes progress on #29

@joshlf joshlf mentioned this pull request Sep 3, 2023
@joshlf joshlf force-pushed the try-from-bytes-minimal-1-maybe-uninit branch 2 times, most recently from 7ba4acc to c7b2773 Compare September 4, 2023 19:25
@joshlf joshlf requested a review from jswrenn September 4, 2023 19:51
@joshlf joshlf force-pushed the try-from-bytes-minimal-1-maybe-uninit branch 2 times, most recently from 0fd6067 to d5f7888 Compare September 5, 2023 17:51
@joshlf joshlf changed the base branch from main to known-layout-3-ref-raw-pointer September 5, 2023 17:53
@joshlf joshlf force-pushed the known-layout-3-ref-raw-pointer branch from 9bc0c28 to cf25d48 Compare September 5, 2023 18:04
@joshlf joshlf force-pushed the try-from-bytes-minimal-1-maybe-uninit branch from d5f7888 to fd7dcba Compare September 5, 2023 18:04
@joshlf joshlf force-pushed the known-layout-3-ref-raw-pointer branch from cf25d48 to a17bec7 Compare September 5, 2023 18:57
@joshlf joshlf force-pushed the try-from-bytes-minimal-1-maybe-uninit branch from fd7dcba to 39d24ff Compare September 5, 2023 18:57
@joshlf joshlf force-pushed the known-layout-3-ref-raw-pointer branch from a17bec7 to 1d52c41 Compare September 5, 2023 20:03
@joshlf joshlf force-pushed the try-from-bytes-minimal-1-maybe-uninit branch 2 times, most recently from 62b67f7 to 2ad98f3 Compare September 6, 2023 01:28
@joshlf joshlf changed the base branch from known-layout-3-ref-raw-pointer to known-layout-2-known-layout September 6, 2023 01:31
@joshlf joshlf force-pushed the try-from-bytes-minimal-1-maybe-uninit branch 2 times, most recently from 430cade to 557dac0 Compare September 6, 2023 03:50
@joshlf joshlf force-pushed the try-from-bytes-minimal-1-maybe-uninit branch from 557dac0 to 7ddaeb4 Compare September 6, 2023 18:30
@joshlf joshlf force-pushed the try-from-bytes-minimal-1-maybe-uninit branch from 7ddaeb4 to fabeea2 Compare September 6, 2023 18:34
The standard library's `MaybeUninit` type does not currently support
wrapping unsized types. This commit introduces a polyfill with the same
behavior as `MaybeUninit` which does support wrapping unsized types.

In this commit, the only supported types are sized types and slice
types. Later (as part of #29), we will add the ability to derive the
`AsMaybeUninit` trait, which will extend support to custom DSTs.

TODO: Figure out how to get rid of KnownLayout<MaybeUninit =
mem::MaybeUninit<T>> bounds.

Makes progress on #29
@joshlf joshlf force-pushed the try-from-bytes-minimal-1-maybe-uninit branch from fabeea2 to 3113e26 Compare September 6, 2023 18:59
@joshlf joshlf deleted the branch known-layout-2-known-layout October 24, 2023 12:39
@joshlf joshlf closed this Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant