From 9734c7e5c0660810eb4b6972345856ef1bca1672 Mon Sep 17 00:00:00 2001 From: Joannis Orlandos Date: Sun, 19 May 2024 22:03:53 +0200 Subject: [PATCH] Put router serialization under SPI again --- Sources/Hummingbird/Router/Trie/RouterTrie.swift | 3 +-- Sources/Hummingbird/Router/Trie/Trie+serialize.swift | 3 --- Sources/Hummingbird/Router/TrieRouter.swift | 12 +++--------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Sources/Hummingbird/Router/Trie/RouterTrie.swift b/Sources/Hummingbird/Router/Trie/RouterTrie.swift index c3f763a1a..313374009 100644 --- a/Sources/Hummingbird/Router/Trie/RouterTrie.swift +++ b/Sources/Hummingbird/Router/Trie/RouterTrie.swift @@ -64,8 +64,7 @@ public final class RouterTrie: Sendable { @usableFromInline let values: [Value?] - @_documentation(visibility: internal) - public init(base: RouterPathTrieBuilder) { + @_spi(Internal) public init(base: RouterPathTrieBuilder) { var trie = Trie() var values: [Value?] = [] diff --git a/Sources/Hummingbird/Router/Trie/Trie+serialize.swift b/Sources/Hummingbird/Router/Trie/Trie+serialize.swift index 4fe1dbae7..9f0bad2d3 100644 --- a/Sources/Hummingbird/Router/Trie/Trie+serialize.swift +++ b/Sources/Hummingbird/Router/Trie/Trie+serialize.swift @@ -15,7 +15,6 @@ import NIOCore extension RouterTrie { - @inlinable static func serialize( _ node: RouterPathTrieBuilder.Node, trie: inout Trie, @@ -82,7 +81,6 @@ extension RouterTrie { trie.nodes[nodeIndex].nextSiblingNodeIndex = trie.nodes.count } - @inlinable static func serializeChildren( of node: RouterPathTrieBuilder.Node, trie: inout Trie, @@ -95,7 +93,6 @@ extension RouterTrie { } } - @inlinable internal static func highestPriorityFirst(lhs: RouterPathTrieBuilder.Node, rhs: RouterPathTrieBuilder.Node) -> Bool { lhs.key.priority > rhs.key.priority } diff --git a/Sources/Hummingbird/Router/TrieRouter.swift b/Sources/Hummingbird/Router/TrieRouter.swift index 885bfc48f..f182da8db 100644 --- a/Sources/Hummingbird/Router/TrieRouter.swift +++ b/Sources/Hummingbird/Router/TrieRouter.swift @@ -15,12 +15,10 @@ import HummingbirdCore /// URI Path Trie Builder -@_documentation(visibility: internal) -public struct RouterPathTrieBuilder { +@_spi(Internal) public struct RouterPathTrieBuilder { @usableFromInline var root: Node - @_documentation(visibility: internal) public init() { self.root = Node(key: .null, output: nil) } @@ -43,7 +41,7 @@ public struct RouterPathTrieBuilder { } } - internal func build() -> RouterTrie { + @_spi(Internal) public func build() -> RouterTrie { .init(base: self) } @@ -52,15 +50,11 @@ public struct RouterPathTrieBuilder { } /// Trie Node. Each node represents one component of a URI path - @_documentation(visibility: internal) - public final class Node { - @usableFromInline + @_spi(Internal) public final class Node { let key: RouterPath.Element - @usableFromInline var children: [Node] - @usableFromInline var value: Value? init(key: RouterPath.Element, output: Value?) {