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:
- Remove
funty from dependencies — Unsigned from num_traits (included in LinkReference via Number) replaces funty::Unsigned
- Remove
FuntyPart trait — the funty() method will be on LinkReference directly
- Remove all explicit
TryFrom/TryInto bounds — they'll be part of LinkReference
- 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
Summary
Replace
funty::UnsignedandFuntyPartin theLinkTypetrait definition withLinkReferencefromplatform-num(Numbers), eliminating thefuntydependency entirely.Current state
platform-data1.0.0 definesLinkTypeas:This depends on
funty2.0.0 for theUnsignedtrait. Meanwhile,platform-treesusesnum_traits::Unsigned(viaplatform-num::Number), which is a different trait from a different crate. This creates incompatibility at the generic level — you can't writeT: data::LinkType + trees::LinkTypewithout dual bounds because neither implies the other.Proposed change
Once linksplatform/Numbers#144 is implemented (adding
TryFrom/TryIntobounds andfunty()method toLinkReference), refactorLinkTypeto:Or simply replace
LinkTypewithLinkReferencethroughout the crate.This would:
funtyfrom dependencies —Unsignedfromnum_traits(included inLinkReferenceviaNumber) replacesfunty::UnsignedFuntyParttrait — thefunty()method will be onLinkReferencedirectlyTryFrom/TryIntobounds — they'll be part ofLinkReferenceplatform-trees— both crates will use the same base traitImpact on downstream crates
doublets-rscan use a singleT: LinkReferencebound instead ofT: data::LinkType + trees::LinkTypeplatform-dataforLinkTypewould get the same concrete type supportRelated
LinkReference