Skip to content

Replace funty dependency with platform-num (Numbers) for LinkType trait #16

Closed

Description

@konard

Summary

Replace funty::Unsigned and FuntyPart in the LinkType trait definition with LinkReference from platform-num (Numbers), eliminating the funty dependency entirely.

Current state

platform-data 1.0.0 defines LinkType as:

pub trait LinkType:
    Unsigned           // from funty 2.0.0
    + FuntyPart        // local trait wrapping TryFrom<u8>
    + TryFrom<i8, Error: Debug>
    + TryFrom<u8, Error: Debug>
    // ... all integer TryFrom/TryInto bounds
{}

This depends on funty 2.0.0 for the Unsigned trait. Meanwhile, platform-trees uses num_traits::Unsigned (via platform-num::Number), which is a different trait from a different crate. This creates incompatibility at the generic level — you can't write T: data::LinkType + trees::LinkType without dual bounds because neither implies the other.

Proposed change

Once linksplatform/Numbers#144 is implemented (adding TryFrom/TryInto bounds and funty() method to LinkReference), refactor LinkType to:

pub trait LinkType: LinkReference {}

Or simply replace LinkType with LinkReference throughout the crate.

This would:

  1. Remove funty from dependencies — Unsigned from num_traits (included in LinkReference via Number) replaces funty::Unsigned
  2. Remove FuntyPart trait — the funty() method will be on LinkReference directly
  3. Remove all explicit TryFrom/TryInto bounds — they'll be part of LinkReference
  4. Unify with platform-trees — both crates will use the same base trait

Impact on downstream crates

  • doublets-rs can use a single T: LinkReference bound instead of T: data::LinkType + trees::LinkType
  • Any crate depending on platform-data for LinkType would get the same concrete type support

Related

Activity

  1. konard commented on Apr 14, 2026

    @konard
    MemberAuthor

    Update from Numbers#144 (platform-num)

    LinkReference in platform-num now includes all bounds needed by data::LinkType:

    data-rs LinkType requirement LinkReference status
    Unsigned ✅ num_traits::Unsigned (replaces funty::Unsigned)
    FuntyPart (TryFrom<u8> + funty method) ✅ Replaced by from_byte(n: u8) -> Self
    TryFrom<T> for all integer types ✅ All 12 types with Error: Debug
    TryInto<T> for all integer types ✅ All 12 types with Error: Debug

    Key decisions

    • funty eliminated: num_traits::Unsigned replaces funty::Unsigned. The from_byte(n: u8) method replaces FuntyPart::funty().
    • u128 support: LinkReference is now explicitly supported for u8, u16, u32, u64, u128, usize.
    • Migration path: Replace T: data::LinkType with T: LinkReference, replace T::funty(n) with T::from_byte(n), and remove the funty dependency.

    See: linksplatform/Numbers#145

    We need to download all logs and data related about the issue to this repository, make sure we compile that data to ./docs/case-studies/issue-{id} folder, and use it to do deep case study analysis (also make sure to search online for additional facts and data), in which we will reconstruct timeline/sequence of events, list of each and all requirements from the issue, find root causes of the each problem, and propose possible solutions and solution plans for each requirement (we should also check known existing components/libraries, that solve similar problem or can help in solutions).

    If there is not enough data to find actual root cause, add debug output and verbose mode if not present, that will allow us to find root cause on next iteration.

    If issue related to any other repository/project, where we can report issues on GitHub, please do so. Each issue must contain reproducible examples, workarounds and suggestions for fix the issue in code.

  2. added
    bug
    on Apr 14, 2026
  3. added theissue type on Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions