feat: Moves core functionality into it's own library.

This commit is contained in:
2024-12-05 09:59:30 -05:00
parent 33356d8648
commit e7bbbec7c2
24 changed files with 464 additions and 387 deletions

View File

@@ -0,0 +1,21 @@
/// A type-erased text node.
public struct AnyTextNode: TextNode {
@usableFromInline
let makeString: () -> String
@inlinable
public init<N: TextNode>(_ node: N) {
self.makeString = node.render
}
@inlinable
public var body: some TextNode { makeString() }
}
public extension TextNode {
@inlinable
func eraseToAnyTextNode() -> AnyTextNode {
AnyTextNode(self)
}
}