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

Use KnownLayout to construct and operate on Refs #678

Merged
merged 1 commit into from
Dec 7, 2023

Commits on Dec 6, 2023

  1. Use KnownLayout to construct and operate on Refs

    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 committed Dec 6, 2023
    Configuration menu
    Copy the full SHA
    752c4e9 View commit details
    Browse the repository at this point in the history