Skip to content

Commit d7da8e0

Browse files
committed
[ResultBuilder] Add AnyGraphContent<NodeID>
1 parent 67a0aa5 commit d7da8e0

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@usableFromInline
2+
struct AnyGraphContent<NodeID: Hashable>: GraphContent {
3+
4+
@usableFromInline
5+
let storage: any GraphContent<NodeID>
6+
7+
@inlinable
8+
init(_ storage: any GraphContent<NodeID>) {
9+
self.storage = storage
10+
}
11+
12+
@inlinable
13+
func _attachToGraphRenderingContext(_ context: inout _GraphRenderingContext<NodeID>) {
14+
storage._attachToGraphRenderingContext(&context)
15+
}
16+
17+
}

Tests/GrapeTests/ContentBuilderTests.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ final class ContentBuilderTests: XCTestCase {
2929

3030
NodeMark(id: 3)
3131
NodeMark(id: 4)
32-
NodeMark(id: 5)
32+
AnyGraphContent(
33+
NodeMark(id: 5)
34+
)
3335
}
3436
}
3537

0 commit comments

Comments
 (0)