Skip to content

Conversation

@joshlf
Copy link
Member

@joshlf joshlf commented Dec 6, 2023

Add Ref::new_known_layout_name_to_be_bikeshedded. This is a private constructor which takes a T: ?Sized + KnownLayout bound. Before we make KnownLayout public, we will make it public and settle on a final name.

Also add the ability to dereference a Ref, requiring the caller to promise bit validity. Refactor TryFromBytes::try_from_ref to use this instead of calling Ptr::as_ref directly, allowing try_from_ref's internal safety comments to be significantly simpler. This machinery can be re-used to add APIs with a T: ?Sized + KnownLayout + FromBytes bound which allow for safe dereferencing.

Makes progress on #29

Add `Ref::new_known_layout_name_to_be_bikeshedded`. This is a private
constructor which takes a `T: ?Sized + KnownLayout` bound. Before we
make `KnownLayout` public, we will make it public and settle on a final
name.

Also add the ability to dereference a `Ref`, requiring the caller to
promise bit validity. Refactor `TryFromBytes::try_from_ref` to use this
instead of calling `Ptr::as_ref` directly, allowing `try_from_ref`'s
internal safety comments to be significantly simpler. This machinery can
be re-used to add APIs with a `T: ?Sized + KnownLayout + FromBytes`
bound which allow for safe dereferencing.

Makes progress on #29
@joshlf joshlf requested a review from jswrenn December 6, 2023 02:08
@joshlf joshlf mentioned this pull request Dec 6, 2023
35 tasks
@joshlf joshlf added this pull request to the merge queue Dec 7, 2023
Merged via the queue into main with commit ff58bf6 Dec 7, 2023
@joshlf joshlf deleted the known-layout-ref-constructor branch December 7, 2023 00:51
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.

3 participants