Skip to content

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

@konard

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 dependenciesUnsigned 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions