Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

SignedAvailabilityBitfields should be a typedef, not a newtype #1339

@coriolinus

Description

@coriolinus

#[derive(Encode, Decode, Clone, PartialEq, Eq, RuntimeDebug)]
pub struct SignedAvailabilityBitfields(pub Vec<SignedAvailabilityBitfield>);

Rationale:

  • We pass around binary encoded bitfields. A newtype may not encode to the same representation as its wrapped type; a typedef always will.
  • The wrapped type is public and we do not implement any interesting traits on the newtype; we aren't gaining any advantage in type safety or ease-of-use.

I suspect this was simply an oversight, but we may as well fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A2-insubstantialPull request requires no code review (e.g., a sub-repository hash update).I8-refactorCode needs refactoring.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions