Repository navigation
Description
Summary
Replace the local LinkType trait definition in platform-trees with LinkReference from platform-num (Numbers), unifying the trait hierarchy across the platform ecosystem.
Current state
platform-trees 0.3.3 defines LinkType as:
pub trait LinkType: Number + Unsigned + Sized + TryFrom<u8> + FromPrimitive {
fn funty(n: u8) -> Self;
}This already depends on platform-num for the Number trait and num-traits for Unsigned and FromPrimitive. The funty() method provides conversion from u8 for creating small constants.
Meanwhile, platform-data uses funty::Unsigned (from the funty crate) instead of num_traits::Unsigned. These are different traits, making it impossible to write unified generic code that works with both data::LinkType and trees::LinkType.
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 works because LinkReference (after Numbers#144) will be a superset of the current trees::LinkType bounds:
Number✅ (already inLinkReference)Unsigned✅ (already inLinkReference)Sized✅ (will be inLinkReference)TryFrom<u8>✅ (will be added in Numbers#144)FromPrimitive✅ (already inLinkReference)funty()method ✅ (will be added in Numbers#144)
Benefits
- Eliminates trait duplication — no more separate
trees::LinkTypevsdata::LinkType - Enables unified generic code — downstream crates like
doublets-rscan use a singleT: LinkReferencebound - Reduces maintenance — trait definition is centralized in
platform-num
Related
- Add TryFrom/TryInto bounds and FuntyPart-like functionality to LinkReference Numbers#144 — Add required bounds to
LinkReference - Replace funty dependency with platform-num (Numbers) for LinkType trait data-rs#16 — Corresponding change for data-rs
- Double check we don't depend on any non stable features of rust and use all the latest best practices and versions of rust in the code doublets-rs#47 — Original issue driving this unification
- Port doublets to stable Rust, migrate deps to crates.io, update CI/CD doublets-rs#48 — PR with full analysis
Activity
konard commentedon Apr 14, 2026
Update from Numbers#144 (platform-num)
LinkReferenceinplatform-numnow includes all bounds needed bytrees::LinkType:LinkTyperequirementLinkReferencestatusNumbernum_traits::UnsignedSizedTryFrom<u8>FromPrimitivefunty(n: u8) -> Selfmethodfrom_byte(n: u8) -> SelfKey decisions
funty()→from_byte(): The method was renamed to remove the crypticfuntycrate reference.from_byteis descriptive and avoids name collision withFromPrimitive::from_u8.u128support:LinkReferenceis now explicitly supported foru8, u16, u32, u64, u128, usize— enabling very large link address spaces indoublets-rs.T: trees::LinkTypewithT: LinkReference, and replaceT::funty(n)calls withT::from_byte(n).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.
Initial commit with task details
feat: replace LinkType with LinkReference from platform-num