-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use KnownLayout to construct and operate on Refs (#678)
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
- Loading branch information
Showing
1 changed file
with
93 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters