Skip to content

Rename StaticXXBuffer to XXBuffer #10

Closed
@Dirbaio

Description

@Dirbaio

Following up on conversations from Matrix.

In 99.9% of the cases HALs should use the StaticXXBuffer traits. However, historically, many HAL implementors have gotten it wrong. Reasons:

  • The difference between them is not easy to understand.
  • The non-static traits look like the "default" choice due to the simpler name
  • The non-static traits look like a better choice due to the better ergonomics of use

Their original purpose was to allow using (unsafely) non-'static buffers with DMA functions.
However, the newer StaticXXBuffer make this possible. They don't have a : 'static bound, but are implemented for 'static buffers only. This allows users to (unsafely) "escape" the requirement by unsafe impling StaticXXBuffer for their types.

Therefore IMO having two sets of traits isn't worth the confusion it adds.

Proposal:

  • Remove ReadBuffer, WriteBuffer
  • Rename StaticReadBuffer, StaticWriteBuffer to ReadBuffer, WriteBuffer

This is a breaking change of course.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions