From 31ab32ff337e1f5b0531d3d5eac6a379d458181c Mon Sep 17 00:00:00 2001 From: Joannis Orlandos Date: Wed, 8 May 2024 14:31:54 +0200 Subject: [PATCH] More specialisation --- Sources/Hummingbird/Router/BinaryTrie/BinaryTrie+resolve.swift | 2 +- .../Hummingbird/Router/BinaryTrie/BinaryTrie+serialize.swift | 1 + Sources/Hummingbird/Router/BinaryTrie/BinaryTrie.swift | 1 + Sources/Hummingbird/Router/TrieRouter.swift | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/Hummingbird/Router/BinaryTrie/BinaryTrie+resolve.swift b/Sources/Hummingbird/Router/BinaryTrie/BinaryTrie+resolve.swift index 547241639..1476e43ab 100644 --- a/Sources/Hummingbird/Router/BinaryTrie/BinaryTrie+resolve.swift +++ b/Sources/Hummingbird/Router/BinaryTrie/BinaryTrie+resolve.swift @@ -50,7 +50,7 @@ extension BinaryTrie { /// If `index != nil`, resolves the `index` to a `Value` /// This is used as a helper in `descendPath(in:parameters:components:)` - @usableFromInline + @inlinable internal func value(for index: UInt16?, parameters: Parameters) -> (value: Value, parameters: Parameters)? { if let index, let value = self.values[Int(index)] { return (value: value, parameters: parameters) diff --git a/Sources/Hummingbird/Router/BinaryTrie/BinaryTrie+serialize.swift b/Sources/Hummingbird/Router/BinaryTrie/BinaryTrie+serialize.swift index 7884da892..e35d0454b 100644 --- a/Sources/Hummingbird/Router/BinaryTrie/BinaryTrie+serialize.swift +++ b/Sources/Hummingbird/Router/BinaryTrie/BinaryTrie+serialize.swift @@ -15,6 +15,7 @@ import NIOCore extension BinaryTrie { + @usableFromInline static func serialize( _ node: RouterPathTrieBuilder.Node, trie: inout ByteBuffer, diff --git a/Sources/Hummingbird/Router/BinaryTrie/BinaryTrie.swift b/Sources/Hummingbird/Router/BinaryTrie/BinaryTrie.swift index f1c6e93b1..dbef4db2f 100644 --- a/Sources/Hummingbird/Router/BinaryTrie/BinaryTrie.swift +++ b/Sources/Hummingbird/Router/BinaryTrie/BinaryTrie.swift @@ -44,6 +44,7 @@ struct BinaryTrieNode { @usableFromInline let values: [Value?] + @inlinable @_spi(Internal) public init(base: RouterPathTrieBuilder) { var trie = ByteBufferAllocator().buffer(capacity: 1024) var values: [Value?] = [] diff --git a/Sources/Hummingbird/Router/TrieRouter.swift b/Sources/Hummingbird/Router/TrieRouter.swift index d805bef12..0b6985c93 100644 --- a/Sources/Hummingbird/Router/TrieRouter.swift +++ b/Sources/Hummingbird/Router/TrieRouter.swift @@ -16,6 +16,7 @@ import HummingbirdCore /// URI Path Trie Builder @_spi(Internal) public struct RouterPathTrieBuilder { + @usableFromInline var root: Node public init() {