Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Commit

Permalink
Add member forwarding from Entry to its item
Browse files Browse the repository at this point in the history
Progress on #15
  • Loading branch information
dabrahams committed Dec 30, 2022
1 parent 6133906 commit 842c667
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/Lotsawa/Chart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ extension Chart {
}

/// A Leo or Earley item bundled with a single mainstem cause.
@dynamicMemberLookup
public struct Entry: Comparable, Hashable {
var item: ItemID

Expand All @@ -298,6 +299,10 @@ extension Chart {
public static func < (lhs: Self, rhs: Self) -> Bool {
(lhs.item.key, lhs.mainstemIndexStorage) < (rhs.item.key, rhs.mainstemIndexStorage)
}

subscript<Target>(dynamicMember m: KeyPath<ItemID, Target>) -> Target {
item[keyPath: m]
}
}

private func isItemIndexStart(_ i: Entries.Index) -> Bool {
Expand Down

0 comments on commit 842c667

Please sign in to comment.