Skip to content

Add WrappingAdd to LinkReference trait bounds #146

@konard

Description

@konard

Summary

LinkReference should include num_traits::WrappingAdd (and potentially other wrapping arithmetic traits) in its supertraits.

Motivation

After removing the LinkType trait from platform-data (linksplatform/data-rs#16), all bounds that were on LinkType need to come from LinkReference directly. The WrappingAdd trait is needed for wrapping unsigned arithmetic in Hybrid (used for internal/external link reference encoding).

Currently, platform-data must add num-traits as an explicit dependency and add + WrappingAdd bounds alongside every LinkReference bound. If LinkReference included WrappingAdd, downstream crates could use T: LinkReference without additional trait bounds.

Proposed change

Add WrappingAdd (from num-traits) to the LinkReference trait definition:

pub trait LinkReference:
    // ... existing bounds ...
    + WrappingAdd
{}

Since WrappingAdd is implemented for all unsigned primitive integer types (the same types LinkReference is implemented for), this is a compatible addition.

Context

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