Skip to content

Convert Offset type alias into newtype #1198

@ojeda

Description

@ojeda

Newtypes allow to constrain what operations make sense on a value in order to prevent mistakes.

Please consider what operations would make sense for the Offset type alias and provide a newtype instead -- please see the thread at: https://lore.kernel.org/rust-for-linux/CANiq72m_LSbyTOg2b0mvDz4+uN+77gpL8T_yiOqi1vKm+G4FzA@mail.gmail.com/

At the time of writing, the patches would need to be based on top of that patch series to update the upcoming users.

Please take the chance as well to write a couple examples/tests for the newtype.

Cc: @dakr


This requires submitting a proper patch to the LKML and the Rust for Linux mailing list. Please recall to test your changes (including generating the documentation if changed, running the Rust doctests if changed, etc.), to use a proper title for the commit, to sign your commit under the Developer's Certificate of Origin and to add a Suggested-by: tag, and a Link: tag to this issue. Please see https://docs.kernel.org/process/submitting-patches.html and https://rust-for-linux.com/contributing for details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomersmediumExpected to be an issue of medium difficulty to resolve.• libRelated to the `rust/` library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions